赫艾后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

385 lines
13 KiB

3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
2 years ago
4 years ago
2 years ago
4 years ago
2 years ago
4 years ago
2 years ago
4 years ago
2 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
2 years ago
4 years ago
3 years ago
2 years ago
4 years ago
3 years ago
4 years ago
2 years ago
4 years ago
4 years ago
3 years ago
4 years ago
2 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
11 months ago
4 years ago
  1. var userId = $("#current_username").val();
  2. var userName = $("#current_username").val();
  3. var site = $("#current_site").val();
  4. var titleName = $("#current_titleName").val();
  5. var currentData = null;
  6. var wareHouseList = new Array();
  7. var wareHouseData = null;
  8. var batchType = "";
  9. //页面初始化
  10. $(function(){
  11. if(titleName != null && titleName != ""){
  12. $("#titleName").text(titleName);
  13. }else {
  14. window.location.href="/login";
  15. }
  16. var workData = $.cookie("transFer");
  17. if(workData != null && workData !==""){
  18. currentData = JSON.parse(workData);
  19. $("#warehouseQty").val(currentData.lotSize);
  20. if(currentData.weightFactor!='0'&&currentData.weightFactor!=''&&currentData.weightFactor!=null){
  21. $("#warehouseQtyKG").val((currentData.lotSize*currentData.weightFactor).toFixed(1));
  22. }else {
  23. $("#warehouseQtyKG").val("erp未维护数据");
  24. }
  25. }
  26. InfoDates("warehousingDate");
  27. getWarehouse()
  28. getBatchType()
  29. // 初始化光标
  30. $("#orderNo_search").focus();
  31. });
  32. // 获取库位信息
  33. function getWarehouse(){
  34. let jsonData = {
  35. site : currentData.site,
  36. userId : userId,
  37. functionName : "Get_Users_AccessWarehouse_List",
  38. }
  39. $.ajax({
  40. url: "/pdaOrder/getUsersAccessWarehouseList",
  41. contentType: 'application/json',
  42. type:"POST",
  43. data:JSON.stringify(jsonData),//你的formid
  44. dataType:"JSON",
  45. beforeSend: function(request) {
  46. request.setRequestHeader("token", $.cookie("token"));
  47. },
  48. success: function (data) {
  49. var list = data.rows;
  50. if(list != null && list.length > 0){
  51. wareHouseList = list;
  52. var departmentTags = '';
  53. for(var i = 0; i< list.length; i++){
  54. if(list[i].Active != null && list[i].Active === "Y" && list[i].WareHouseType_DB != null && list[i].WareHouseType_DB === "P"){
  55. departmentTags += '<option value="'+list[i].WareHouseID+'">'+list[i].WareHouseName+'</option>';
  56. }
  57. }
  58. $("#warehouse_id").html(departmentTags).change();
  59. if(currentData.defaultWarehouseID!=''&&currentData.defaultWarehouseID!=null){
  60. $("#warehouse_id").val(currentData.defaultWarehouseID)
  61. }
  62. warehouseChange()
  63. }
  64. },
  65. error: function(data) {
  66. var responseText = data.responseText;
  67. var json_str = JSON.parse(responseText);
  68. var status = json_str.status;
  69. var message = json_str.message;
  70. //判断是否是session超时
  71. if(403==status){
  72. layer.alert(message,function(){
  73. window.location.href="/login";
  74. });
  75. }
  76. layer.closeAll('loading');
  77. }
  78. })
  79. }
  80. //生产出库工单失去焦点事件
  81. $('#warehouseQtyKG').blur(function () {
  82. let warehouseQtyKG=$('#warehouseQtyKG').val();
  83. let weightFactor=currentData.weightFactor;
  84. if(weightFactor!=0&&weightFactor!=-1&&warehouseQtyKG!=''){
  85. $('#warehouseQty').val((warehouseQtyKG/weightFactor).toFixed(1))
  86. }
  87. if(warehouseQtyKG==''){
  88. $('#warehouseQty').val("")
  89. }
  90. })
  91. //生产出库工单失去焦点事件
  92. $('#warehouseQty').blur(function () {
  93. let warehouseQty=$('#warehouseQty').val();
  94. let weightFactor=currentData.weightFactor;
  95. if(weightFactor!=0&&weightFactor!=-1&&warehouseQty!=''){
  96. $('#warehouseQtyKG').val((warehouseQty*weightFactor).toFixed(1))
  97. }
  98. if(warehouseQty==''){
  99. $('#warehouseQtyKG').val("")
  100. }
  101. })
  102. // 获取批号信息
  103. function getBatchType(){
  104. let jsonData = {
  105. site : currentData.site,
  106. partNo : currentData.partNo,
  107. functionName : "dbo.Get_Part_BatchCreatedMethod",
  108. }
  109. $.ajax({
  110. url: "/pdaOrder/getPartBatchCreatedMethod",
  111. contentType: 'application/json',
  112. type:"POST",
  113. data:JSON.stringify(jsonData),//你的formid
  114. dataType:"JSON",
  115. beforeSend: function(request) {
  116. request.setRequestHeader("token", $.cookie("token"));
  117. },
  118. success: function (data) {
  119. if(data.code == 0){
  120. batchType = data.result;
  121. $("#batchNo").val("");
  122. if(batchType == "基于入库单单号" || batchType == "基于入库时间" ){
  123. $('#batchNo').attr("disabled",true);
  124. }else if(batchType == "不采用批号"){
  125. $("#batchNo").val("*");
  126. $('#batchNo').attr("disabled",true);
  127. }else {
  128. $('#batchNo').attr("disabled",false);
  129. }
  130. }
  131. },
  132. error: function(data) {
  133. var responseText = data.responseText;
  134. var json_str = JSON.parse(responseText);
  135. var status = json_str.status;
  136. var message = json_str.message;
  137. //判断是否是session超时
  138. if(403==status){
  139. layer.alert(message,function(){
  140. window.location.href="/login";
  141. });
  142. }
  143. layer.closeAll('loading');
  144. }
  145. })
  146. }
  147. function warehouseChange(){
  148. var warehouseId = $("#warehouse_id").val();
  149. for (var i = 0; i < wareHouseList.length; i++) {
  150. if(wareHouseList[i].WareHouseID == warehouseId){
  151. $("#locationId").val("");
  152. wareHouseData = wareHouseList[i];
  153. if(wareHouseList[i].UseLocation != null && wareHouseList[i].UseLocation === "Y"){
  154. $("#locationId").val("");
  155. $('#locationId').attr("disabled",false);
  156. }else {
  157. $("#locationId").val("*");
  158. $('#locationId').attr("disabled",true);
  159. }
  160. break
  161. }
  162. }
  163. }
  164. //为报废原因绑定一个失去焦点事件
  165. $("#warehouse_id").change(function() {
  166. warehouseChange()
  167. })
  168. // 获取获取工具实例编码
  169. function receiveFlag(){
  170. var warehouseDate = $("#warehousingDate").val();
  171. var warehouseQty = $("#warehouseQty").val();
  172. var warehouseId = $("#warehouse_id").val().toUpperCase();
  173. var locationId = $("#locationId").val().toUpperCase();
  174. var batchNo = $("#batchNo").val();
  175. var printNumber = $("#printNumber").val();
  176. if(warehouseDate == null || warehouseDate === ""){
  177. layer.msg("请选择入库日期!");
  178. return false
  179. }
  180. if(warehouseQty == null || warehouseQty === "" || warehouseQty <=0){
  181. layer.msg("请输入入库数量!");
  182. return false
  183. }
  184. if(warehouseId == null || warehouseId === ""){
  185. layer.msg("请选择仓库!");
  186. return false
  187. }
  188. if( wareHouseData.UseLocation === "Y" &&(locationId == null || locationId === "")){
  189. layer.msg("请输入库位!");
  190. return false
  191. }
  192. if(batchType != "基于入库单单号" && batchType != "基于入库时间" && batchType != "不采用批号"){
  193. if(batchNo == null || batchNo === ""){
  194. layer.msg("请输入批号!");
  195. return false
  196. }
  197. }
  198. if(printNumber == null || printNumber === "" || printNumber === "0"){
  199. layer.msg("请填写要打印的标签打印数量!");
  200. return false
  201. }
  202. let jsonData = {
  203. site : currentData.site,
  204. /*warehouseDate : warehouseDate,
  205. warehouseId : warehouseId,
  206. locationId : locationId,
  207. batchNo : batchNo,
  208. remark : remark,*/
  209. transQty : warehouseQty,
  210. functionName : "SO_Receive_FG_Confirm",
  211. orderNo : currentData.orderNo,
  212. }
  213. $.ajax({
  214. url: "/pdaOrder/getSOReceiveFGConfirm",
  215. contentType: 'application/json',
  216. type:"POST",
  217. data:JSON.stringify(jsonData),//你的formid
  218. dataType:"JSON",
  219. beforeSend: function(request) {
  220. request.setRequestHeader("token", $.cookie("token"));
  221. },
  222. success: function (data) {
  223. if(data.code == 200){
  224. saveProduction()
  225. }else {
  226. layer.confirm(data.msg, {
  227. btn : [ '确定', '取消' ]
  228. // 按钮
  229. }, function() {
  230. saveProduction();
  231. }, function() {
  232. });
  233. }
  234. },
  235. error: function(data) {
  236. var responseText = data.responseText;
  237. var json_str = JSON.parse(responseText);
  238. var status = json_str.status;
  239. var message = json_str.message;
  240. //判断是否是session超时
  241. if(403==status){
  242. layer.alert(message,function(){
  243. window.location.href="/login";
  244. });
  245. }
  246. layer.closeAll('loading');
  247. }
  248. })
  249. }
  250. // 获取获取工具实例编码
  251. function saveProduction(){
  252. var warehouseDate = $("#warehousingDate").val();
  253. var warehouseQty = $("#warehouseQty").val();
  254. var warehouseId = $("#warehouse_id").val().toUpperCase();
  255. var locationId = $("#locationId").val().toUpperCase();
  256. var batchNo = $("#batchNo").val();
  257. var remark = $("#remark").val();
  258. var printNumber = $("#printNumber").val();
  259. let strSeqNo='00000'+currentData.seqNo;
  260. let scanList = JSON.parse(localStorage.getItem("scanList"))[0];
  261. let jsonData = {
  262. site : currentData.site,
  263. orderNo : currentData.orderNo,
  264. transDate : warehouseDate,
  265. warehouseId : warehouseId,
  266. partnerId : "",
  267. partNo : currentData.partNo,
  268. batchNo : currentData.orderNo.substring(4)+'-'+strSeqNo.substring(strSeqNo.length-5),
  269. locationId : locationId,
  270. transQty : warehouseQty,
  271. userId : userId,
  272. receiver : userName,
  273. remark : remark,
  274. transFerNo:currentData.transFerNo,
  275. printNumber:printNumber,
  276. functionName : "[dbo].[SO_Receive_FG_TransFer]",
  277. useLocationFlag:wareHouseData.UseLocation,
  278. scanList:scanList,
  279. }
  280. $.ajax({
  281. url: "/pdaOrder/saveSOReceiveFGTransFer",
  282. contentType: 'application/json',
  283. type:"POST",
  284. data:JSON.stringify(jsonData),//你的formid
  285. dataType:"JSON",
  286. beforeSend: function(request) {
  287. request.setRequestHeader("token", $.cookie("token"));
  288. },
  289. success: function (data) {
  290. // layer.msg(data.msg);
  291. if(data.code == 0){
  292. // cleanInput()
  293. pdaBaseJump2()
  294. localStorage.removeItem("scanList");
  295. }else {
  296. layer.msg(data.msg);
  297. }
  298. },
  299. error: function(data) {
  300. var responseText = data.responseText;
  301. var json_str = JSON.parse(responseText);
  302. var status = json_str.status;
  303. var message = json_str.message;
  304. //判断是否是session超时
  305. if(403==status){
  306. layer.alert(message,function(){
  307. window.location.href="/login";
  308. });
  309. }
  310. layer.closeAll('loading');
  311. }
  312. })
  313. }
  314. function cleanInput(){
  315. $("#warehouseQty").val(0);
  316. $("#batchNo").val("");
  317. $("#remark").val("");
  318. $("#warehouse_id option:first").prop("selected", 'selected').change();
  319. }
  320. //回退上一步
  321. function pdaBaseJump(){
  322. var menuId = $("#menuId").val();
  323. var titleName = "回退";
  324. window.location.href = "/pda/transferWarehousingScanLabel?menuId=" +menuId +"&titleName=" +titleName;
  325. }
  326. //下级界面页面跳转
  327. function pdaBaseJump2(){
  328. var menuId = $("#menuId").val();
  329. var titleName = '不要缓存';
  330. window.location.href = "/pda/transferWarehousing?menuId=" +menuId +"&titleName=" +titleName;
  331. }
  332. function InfoDates(date){
  333. var default_date = getNowFormatDate();
  334. $("#" + date).val(default_date);
  335. //初始化模态框的日期
  336. $.fn.datetimepicker.dates['zh-CN'] = {
  337. days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
  338. daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
  339. daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
  340. months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
  341. monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
  342. today: "今天",
  343. suffix: [],
  344. meridiem: ["上午", "下午"]
  345. };
  346. $("#"+date).datetimepicker({
  347. format : 'yyyy-mm-dd',//显示格式
  348. maxView : 4,//最高能展示的时间,Number, String类型 默认值:4, 年
  349. minView : 2,//日期时间选择器所能够提供的最精确的时间选择视图
  350. autoclose : true,//选择后自动关闭
  351. todayBtn : true,//开启选择今天的按钮
  352. todayHighlight: true,//今天日期高亮显示 如果为true, 高亮当前日期。Boolean类型 ,默认值:false ,
  353. language : 'zh-CN'//语言选择中文
  354. });
  355. }
  356. //初始化下拉框
  357. function selectInit(){
  358. $('.selectpicker').selectpicker({
  359. noneSelectedText: '',
  360. noneResultsText: '',
  361. liveSearch: true,
  362. width:140,
  363. size:5 //设置select高度,同时显示5个值
  364. });
  365. }