From 6f7e999691fc768d427b7130c9fcc7f3017e1fbc Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期四, 16 五月 2024 17:07:29 +0800 Subject: [PATCH] 1.销售管理,仓库管理 所有的 新增 审核 反审核 删除 增加 进行 会计期间 结账 的判断和控制 2.岗位技能清单 和 员工技能清单 表头 增加 2个 字段; HMaterID int --产品编码(gy_Material) HProcID int --工序(gy_Process) --- WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs | 411 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 367 insertions(+), 44 deletions(-) diff --git a/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs b/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs index a495249..70a60b5 100644 --- a/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs +++ b/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs @@ -8,6 +8,7 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using System.Windows.Forms; namespace WebAPI.Controllers { @@ -276,7 +277,6 @@ string user = sArray[2].ToString(); string OperationType = sArray[3].ToString(); - string UserName = ""; ListModels oListModels = new ListModels(); try { @@ -296,19 +296,9 @@ lsmain = oListModels.getSellOutBillMainByJson(msg2); foreach (Model.ClsKf_SellOutBillMain oItem in lsmain) { - //oItem.HMaker = ""; - UserName = oItem.HMaker; - oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); - oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); - oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); - oItem.HBillType = "1205"; - oItem.HBillSubType = "1205"; - oItem.HBillStatus = 0; - oItem.HPeriod = 0; oItem.HMaker = user; - oItem.HMainSourceInterID = oItem.HInterID; + oItem.HUpDater = user; - //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; @@ -324,50 +314,84 @@ msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n - //msg2 = msg2.Replace("'", "鈥�"); List<Model.ClsKf_SellOutBillSub> ls = new List<Model.ClsKf_SellOutBillSub>(); ls = oListModels.getSellOutBillSubByJson(msg3); int i = 0; foreach (Model.ClsKf_SellOutBillSub oItemSub in ls) { i++; - oItemSub.HEntryID = i; - //oItemSub.HSourceEntryID = 0; - //oItemSub.HSourceInterID = 0; - //oItemSub.HSourceBillNo = ""; - //oItemSub.HSourceBillType = ""; - oItemSub.HRelationQty = 0; - oItemSub.HRelationMoney = 0; - - - // DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; oItemSub.HCloseMan = ""; - //oItemSub.HRemark = ""; oBill.DetailColl.Add(oItemSub); + } + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; } //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; - if (Convert.ToInt32(OperationType) == 1) + if (Convert.ToInt32(OperationType) == 1) //鏂板淇濆瓨 { - // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } else if(Convert.ToInt32(OperationType) == 4) //涓嬫帹淇濆瓨 + { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } - else + else //缂栬緫淇濆瓨 { + if (BillOld.ShowBill(lsmain[0].HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } + if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; - //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); objJsonResult.data = 1; return objJsonResult; } @@ -398,7 +422,8 @@ { try { - ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList"); + //ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList_EditInit where hmainid=" + HInterID, "h_v_IF_SellOutBillList_EditInit"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -516,7 +541,16 @@ objJsonResult.data = null; return objJsonResult; } - + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 @@ -531,29 +565,118 @@ return objJsonResult; } - //瀹℃牳鎻愪氦 - if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) - { - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛"; - objJsonResult.data = null; - return objJsonResult; - } - else + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Kf_SellOutBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; objJsonResult.data = null; return objJsonResult; } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + oCN.BeginTran(); + //澧炲姞鍏宠仈 + oCN.RunProc("exec h_p_Kf_SellOutBill_Check " + HInterID + ",'" + oBill.BillType + "','" + CurUserName + "'"); + //鍐欏叆鏃ュ織 + string WorkList = "瀹℃牳鍗曟嵁锛屽崟鎹彿锛�" + oBill.omodel.HBillNo; + string SystemName = "LMES-閿�鍞嚭搴撳崟妯″潡"; + oCN.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + CurUserName + "','" + SystemInformation.ComputerName + "','" + WorkList + "','" + SystemName + "','','瀹℃牳')" + ); + + + //瀹℃牳鍚庢帶鍒�========================================= + string sql = "exec h_p_Kf_SellOutBill_AfterCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Kf_SellOutBill_AfterCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳杩囩▼涓嚭閿欙紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } + //========================================= + + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + + //if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + //{ + // objJsonResult.code = "1"; + // objJsonResult.count = 1; + // objJsonResult.Message = "瀹℃牳鎴愬姛"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //else + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + // objJsonResult.data = null; + // return objJsonResult; + //} } if (IsAudit == 1) //鍙嶅鏍告彁浜� { - //鍙嶅鏍告彁浜bandonCheck - if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_Kf_SellOutBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + //鍒犻櫎鍏宠仈 + oCN.BeginTran(); + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_UnCheck " + HInterID + ",'" + CurUserName + "'"); + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_SellOutBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鍙嶅鏍告垚鍔�"; @@ -562,6 +685,7 @@ } else { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; @@ -573,6 +697,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); @@ -863,5 +988,203 @@ } } #endregion + + #region 閿�鍞嚭搴� 鏉$爜鏄庣粏 + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <returns></returns> + [Route("Kf_SellOutBill/BarCodeNote")] + [HttpGet] + public object SellOutBill_BarCodeNote(int HInterID) + { + try + { + List<object> columnNameListSum = new List<object>(); + List<object> columnNameList0 = new List<object>(); + List<object> columnNameList1 = new List<object>(); + List<object> columnNameList2 = new List<object>(); + + string sql = "exec h_p_Kf_SellOutBillBarCodeNote " + HInterID; + ds = oCN.RunProcReturn(sql, "h_p_Kf_SellOutBillBarCodeNote"); + + //娣诲姞 鍩烘湰淇℃伅 鍒楀悕 + foreach (DataColumn col in ds.Tables[1].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList0.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + //娣诲姞 鐮佸崟淇℃伅 鍒楀悕 + foreach (DataColumn col in ds.Tables[2].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList1.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + //娣诲姞 鏉$爜鏄庣粏 鍒楀悕 + foreach (DataColumn col in ds.Tables[3].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList2.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + columnNameListSum.Add(columnNameList0); + columnNameListSum.Add(columnNameList1); + columnNameListSum.Add(columnNameList2); + + List<DataTable> tableList = new List<DataTable>(); + tableList.Add(ds.Tables[1]); + tableList.Add(ds.Tables[2]); + tableList.Add(ds.Tables[3]); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = tableList; + objJsonResult.list = columnNameListSum; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞嚭搴撳崟 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栭攢鍞嚭搴撳崟鏁版嵁 + [Route("Kf_SellOutBill/loadKf_SellOutBill_Push")] + [HttpGet] + public object loadKf_SellOutBill_Push(long HInterID, long HSubID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList_EditInit where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_SellOutBillList_EditInit"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞嚭搴撳崟 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栧彂璐ч�氱煡鍗曟暟鎹� + [Route("Kf_SellOutBill/loadXs_SeOutStockBill_Push")] + [HttpGet] + public object loadXs_SeOrderBill_Push(long HInterID, long HSubID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_SeOutStockBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞嚭搴撳崟 妫�鏌ュ崟鎹槸鍚﹀瓨鍦� + /// <summary> + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <returns></returns> + [Route("Kf_SellOutBill/CheckSellOutBill_IsExist")] + [HttpGet] + public object CheckSellOutBill_IsExist(int HInterID) + { + try + { + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsKf_SellOutBill oBill = new DAL.ClsKf_SellOutBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁瀛樺湪"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绋嬪簭閿欒锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1