| | |
| | | |
| | | |
| | | if (HMaterNumber) { |
| | | sWhere += " and 物料代码 = '" + HMaterNumber + "'"; |
| | | sWhere += " and 物料代码 like '%" + HMaterNumber + "%'"; |
| | | } |
| | | if (HMaterName) { |
| | | sWhere += " and 物料名称 = '" + HMaterName + "'"; |
| | | sWhere += " and 物料名称 like '%" + HMaterName + "%'"; |
| | | } |
| | | if (HModel) { |
| | | sWhere += " and 规格型号 = '" + HModel + "'"; |
| | | sWhere += " and 规格型号 like '%" + HModel + "%'"; |
| | | } |
| | | if (IsUse!=0) { |
| | | sWhere += " and 是否启用 = '" + IsUse + "'"; |
| | |
| | | if (checkStatus.data.length === 1) { |
| | | var InterID = data[0].HItemID.toString(); |
| | | var HMaterID = data[0].物料ID.toString(); |
| | | //逻辑审核方法 |
| | | var FirstID = sessionStorage["HSupIDs"]; |
| | | var HSupID = FirstID.split(",")[0]; |
| | | /* var HSupID = "672189";*/ |
| | | |
| | | // 先检查是否存在多条记录 |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: GetWEBURL() + "/MaterialHandingController/OpenMaterial", //方法所在页面和方法名 |
| | | data: { "HInterID": InterID, "IsUse": num, "CurUserName": sessionStorage["HUserName"], "HMaterID": HMaterID}, |
| | | url: GetWEBURL() + "/MaterialHandingController/CheckMaterialCount", |
| | | data: { |
| | | "HMaterID": HMaterID, |
| | | "HSupID": HSupID, |
| | | "HInterID": InterID |
| | | }, |
| | | success: function (result) { |
| | | if (result.count == 1) { |
| | | layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () { |
| | | //// 得到frame索引 |
| | | var index = layer.getFrameIndex(window.name); |
| | | ////关闭当前frame |
| | | if (result.count > 0) { |
| | | // 存在多条记录,弹出确认框 |
| | | layer.confirm('同一供应商下的该物料存在多条记录,是否将其余记录设置为未启用?', { |
| | | btn: ['确定', '取消'], |
| | | title: "启用确认" |
| | | }, function (index) { |
| | | //传1,使用update |
| | | layer.close(index); |
| | | //修改为功后刷新界面 |
| | | $("#btnSearch").trigger('click'); |
| | | callForEnable(InterID, HMaterID, HSupID, 1, num); |
| | | }, function (index) { |
| | | //传0,直接启用 |
| | | layer.close(index); |
| | | //callForEnable(InterID, HMaterID, HSupID, 0, num); |
| | | }); |
| | | |
| | | } else { |
| | | layer.alert("已经启用,不准再次启用!", { icon: 5 }); |
| | | // 没有多条记录,直接启用 |
| | | callForEnable(InterID, HMaterID, HSupID, 0, num); |
| | | } |
| | | }, error: function () { |
| | | layer.alert("接口请求失败!", { icon: 5 }); |
| | | }, |
| | | error: function () { |
| | | layer.alert("检查记录数量失败!", { icon: 5 }); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | function callForEnable(InterID, HMaterID, HSupID, disableOthers, num) { |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: GetWEBURL() + "/MaterialHandingController/OpenMaterial", |
| | | data: { |
| | | "HInterID": InterID, |
| | | "IsUse": num, |
| | | "CurUserName": sessionStorage["HUserName"], |
| | | "HMaterID": HMaterID, |
| | | "HSupID": HSupID, |
| | | "disableOthers": disableOthers |
| | | }, |
| | | success: function (result) { |
| | | if (result.count == 1) { |
| | | layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () { |
| | | // 得到frame索引 |
| | | var index = layer.getFrameIndex(window.name); |
| | | // 关闭当前frame |
| | | layer.close(index); |
| | | // 修改成功后刷新界面 |
| | | $("#btnSearch").trigger('click'); |
| | | }); |
| | | } else { |
| | | layer.alert(result.Message, { icon: 5 }); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.alert("接口请求失败!", { icon: 5 }); |
| | | } |
| | | }); |
| | | } |
| | | //#endregion |
| | | |
| | | |
| | | function get_createBarCode() { |
| | | var checkStatus = table.checkStatus('mainTable') |