更新启用物料信息状态添加供应商过滤;新增送货物料信息物料id加组织过滤;条码档案数据信息处理;
| | |
| | | try |
| | | { |
| | | //ds1获取的sql后期记得改回供应商,修改人->供应商 |
| | | var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 物料代码='" + HMaterID + "'" + "and 供应商代码='" + SupID + "'", "h_v_Gy_UserMaterRelationEdit"); |
| | | var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 物料代码='" + HMaterID + "'" + "and HSupID ='" + SupID + "'", "h_v_Gy_UserMaterRelationEdit"); |
| | | var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + HMaterID+ "'"+ " and HUSEORGID="+"'"+ OrganizationID+"'", "Gy_Material"); |
| | | if(ds.Tables[0].Rows.Count == 0) |
| | | { |
| | |
| | | else |
| | | { |
| | | oCN.BeginTran(); |
| | | string sqlUpd = "UPDATE Gy_UserMaterRelation set HUseFlag=0 where HItemID=" + ds1.Tables[0].Rows[0]["HItemID"]; |
| | | string sqlUpd = "UPDATE a set a.HUseFlag=0 from Gy_UserMaterRelation a with(nolock) left join Gy_Material m with(nolock) " + |
| | | "on a.HMaterID = m.HItemID where a.HSupID=" + SupID + " and m.HNumber = '" + HMaterID + "'"; |
| | | oCN.RunProc(sqlUpd); |
| | | oCN.Commit(); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | //var _value = msg["msg"].ToString(); |
| | | //string msg3 = _value.ToString(); |
| | | ////string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | ////string msg1 = sArray[0].ToString(); |
| | | ////string msg2 = sArray[1].ToString(); |
| | | //string msg2 = msg3.ToString(); |
| | | |
| | | var _value = msg["msg"].ToString(); |
| | | string msg3 = _value.ToString(); |
| | | //string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | //string msg1 = sArray[0].ToString(); |
| | | //string msg2 = sArray[1].ToString(); |
| | | string msg2 = msg3.ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString();// |
| | | string OrganizationID = sArray[1].ToString();// |
| | | |
| | | //反序列化 |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | |
| | | List<Model.Cls_MaterialHandingModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls_MaterialHandingModel>>(msg2); |
| | | |
| | | var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + list[0].HMaterNumber + "'", "Gy_Material"); |
| | | var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + list[0].HMaterNumber + "' and HUSEORGID = " + OrganizationID, "Gy_Material"); |
| | | |
| | | int HItemID =Convert.ToInt32(list[0].HItemID); |
| | | string HMaterNumber = list[0].HMaterNumber; |
| | |
| | | |
| | | } |
| | | //#endregion |
| | | #region 主页面启用 |
| | | [Route("MaterialHandingController/CheckMaterialCount")] |
| | | [HttpGet] |
| | | public object CheckMaterialCount(string HMaterID, string HSupID, int HInterID) |
| | | { |
| | | try |
| | | { |
| | | //检查同供应商下是否有其他物料 |
| | | string sql = "SELECT COUNT(*) as Count FROM Gy_UserMaterRelation " + |
| | | "WHERE HMaterID = '" + HMaterID + "' AND HSupID = " + HSupID + |
| | | " AND HItemID != " + HInterID; |
| | | var ds = oCN.RunProcReturn(sql, "Gy_UserMaterRelation"); |
| | | int count = Convert.ToInt32(ds.Tables[0].Rows[0]["Count"]); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = count; |
| | | objJsonResult.Message = "查询成功"; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询失败: " + e.Message; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | [Route("MaterialHandingController/OpenMaterial")] |
| | | [HttpGet] |
| | | public object OpenMaterial(int HInterID, int IsUse, string CurUserName, string HMaterID, string HSupID, int disableOthers) |
| | | { |
| | | try |
| | | { |
| | | var ds = oCN.RunProcReturn("SELECT * FROM Gy_UserMaterRelation WHERE HItemID=" + HInterID, "Gy_UserMaterRelation"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | int currentUseFlag = Convert.ToInt32(ds.Tables[0].Rows[0]["HUseFlag"]); |
| | | |
| | | // 检查是否已启用 |
| | | if (currentUseFlag == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已启用!不能再次启用!"; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | // 如果用户选择禁用 |
| | | if (disableOthers == 1) |
| | | { |
| | | string disableSql = "UPDATE Gy_UserMaterRelation SET HUseFlag=0 " + |
| | | "WHERE HMaterID='" + HMaterID + "' AND HSupID=" + HSupID + |
| | | " AND HItemID!=" + HInterID; |
| | | oCN.RunProc(disableSql); |
| | | } |
| | | |
| | | // 启用前控制 |
| | | string sql1 = "EXEC h_p_Gy_MaterPrice_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeStopCtrl"); |
| | | |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "启用失败!原因:启用前判断失败,请与网络管理人员联系"; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "启用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | // 启用当前记录 |
| | | oCN.RunProc("UPDATE Gy_UserMaterRelation SET HUpDater='" + CurUserName + |
| | | "', HUpDateDate=GETDATE(), HUseFlag=1 WHERE HItemID=" + HInterID); |
| | | |
| | | // 启用后控制 |
| | | string sql2 = "EXEC h_p_Gy_MaterPrice_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterStopCtrl"); |
| | | |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "启用失败!原因:启用后判断失败,请与网络管理人员联系"; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "启用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "启用成功"; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "启用失败!" + e.Message; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString();// |
| | | string msg3 = sArray[1].ToString();// |
| | | string UserName = ""; |
| | | string UserName = sArray[2].ToString(); |
| | | string OrganizationID = sArray[3].ToString(); |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_MaterialHanding(msg2); |
| | | int get_BarCodecount = 0; |
| | | |
| | | foreach (Model.Cls_MaterialHandingModel oItem in lsmain) |
| | | { |
| | | get_BarCodecount++; |
| | | UserName = oItem.HMaker; |
| | | //UserName = oItem.HMaker; |
| | | } |
| | | DAL.ClsWeb_BarCodeBill oBill = new DAL.ClsWeb_BarCodeBill(); |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | |
| | | |
| | | ls = oListModels.getObjectByJson_BarCodeBill(msg3);//列表数据model |
| | | |
| | | if (ls.Count > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "每次只允许选择一个物料生成条码,请退出重新选择一行物料,不允许选择多行物料!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #region 数据准备 |
| | | long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo); |
| | |
| | | : HMinQty; |
| | | ///供应商名称+@+物料代码+@+物料简称+@+数量+@条码数+@+日期+@+流水号 |
| | | LSH += 1; |
| | | TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{currentQty}@{HBarCodeDate_1}@{LSH}"; |
| | | TM = $"{oItemSub.HSupName}@{oItemSub.HMaterNumber}@{oItemSub.HSubjoin}@{currentQty}@{HBarCodeDate_1}@{LSH.ToString("D7")}"; |
| | | //TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{oItemSub.biaoqianzhangshu}@{HKFDate_1}@{LSH}"; |
| | | // 添加到生成的条码列表 |
| | | generatedBarcodes.Add(TM); |
| | |
| | | // + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")"; |
| | | sql = "INSERT INTO Gy_BarCodeBill (HInterID, HBarCode, HBarCodeType, HMaterID, HUnitID, HQty, HKFDate, HKFPeriod, HKFDQDate, " + |
| | | "HBatchNo, HBarcodeQtys, HBarcodeNo, HSupID, HGroupID, HMaker, HMakeDate, HPrintQty, HEndQty, HSupflag, " + |
| | | "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty) " + |
| | | "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty,HSTOCKORGID,HOWNERID) " + |
| | | "VALUES (" + |
| | | linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + HKFDate + "', " + HKFPeriod + ", '" + HKFDQDate + "', " + |
| | | "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + ClsPub.CurUserName + "', '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "1" + ", " + "0" + ", 1, " + |
| | | "1, 1, '1', '" + HSourceBillType + "', '1', '" + |
| | | HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'" + ")"; |
| | | linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + null + "', " + HKFPeriod + ", '" + null + "', " + |
| | | "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + UserName + "',getdate()" + "," + "0" + ", " + "0" + ", 1, " + |
| | | "0, 0, '', '" + HSourceBillType + "', '', '" + |
| | | null + "', '" + null + "', " + HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'," + OrganizationID + "," + OrganizationID + "," + null + ")"; |
| | | LogService.Write("生成条码: " + sql); |
| | | oCn.RunProc(sql); |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HSupID + "_" + HMaterID + "_" + HBarCodeDate + "'"); |
| | |
| | | public string HRemark; |
| | | public string HStatusMan; //惠康工号 |
| | | public string HBarCodeDate; //条码日期 |
| | | public string HSubjoin; //条码日期 |
| | | // public ClsGy_MaterialBarCodeBillModel(); |
| | | } |
| | | } |