Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
| | |
| | | omodel.MES_StationEntrustOutBill_SaveAutoAddnew = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | |
| | | |
| | | //=============================é¦ä»¶æ£éªå |
| | | //ä¿å忝å¦èªå¨å®¡æ ¸ |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_FirstPieceCheckBill_AutoCheck") |
| | | { |
| | | omodel.QC_FirstPieceCheckBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //ä¿ååå为æ°å¢ç¶æ |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_FirstPieceCheckBill_SaveAutoAddnew") |
| | | { |
| | | omodel.QC_FirstPieceCheckBill_SaveAutoAddnew = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //å é¤äººå¿
é¡»æ¯å¶å人 |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_FirstPieceCheckBill_DeleterAndMakerMustSame") |
| | | { |
| | | omodel.QC_FirstPieceCheckBill_DeleterAndMakerMustSame = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //è´¨æ£æ¹æ¡æ¥æº |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_FirstPieceCheckBill_QCSchemeSource") |
| | | { |
| | | omodel.QC_FirstPieceCheckBill_QCSchemeSource = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | |
| | | |
| | | |
| | | //=============================å·¡æ£å |
| | | //ä¿å忝å¦èªå¨å®¡æ ¸ |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_PatrolProcCheckBill_AutoCheck") |
| | | { |
| | | omodel.QC_PatrolProcCheckBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //ä¿ååå为æ°å¢ç¶æ |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_PatrolProcCheckBill_SaveAutoAddnew") |
| | | { |
| | | omodel.QC_PatrolProcCheckBill_SaveAutoAddnew = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //å é¤äººå¿
é¡»æ¯å¶å人 |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_PatrolProcCheckBill_DeleterAndMakerMustSame") |
| | | { |
| | | omodel.QC_PatrolProcCheckBill_DeleterAndMakerMustSame = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //è´¨æ£æ¹æ¡æ¥æº |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_PatrolProcCheckBill_QCSchemeSource") |
| | | { |
| | | omodel.QC_PatrolProcCheckBill_QCSchemeSource = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | |
| | | |
| | | //=============================å·¥åºè½¬åºæ£éªå |
| | | //ä¿å忝å¦èªå¨å®¡æ ¸ |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_ProcessCheckBill_AutoCheck") |
| | | { |
| | | omodel.QC_ProcessCheckBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //ä¿ååå为æ°å¢ç¶æ |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_ProcessCheckBill_SaveAutoAddnew") |
| | | { |
| | | omodel.QC_ProcessCheckBill_SaveAutoAddnew = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //å é¤äººå¿
é¡»æ¯å¶å人 |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_ProcessCheckBill_DeleterAndMakerMustSame") |
| | | { |
| | | omodel.QC_ProcessCheckBill_DeleterAndMakerMustSame = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | //è´¨æ£æ¹æ¡æ¥æº |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "QC_ProcessCheckBill_QCSchemeSource") |
| | | { |
| | | omodel.QC_ProcessCheckBill_QCSchemeSource = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]); |
| | | } |
| | | |
| | | |
| | | |
| | | //æ¥å·¥å°ï¼å·¥åºæ±æ¥èªå¨å®¡æ ¸åæ° |
| | | if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Sc_MESProceReportWorkBill_AutoCheck") |
| | | { |
| | |
| | | public string QC_FirstPieceCheckBill_AutoCheck; //ä¿å忝å¦èªå¨å®¡æ ¸ |
| | | public string QC_FirstPieceCheckBill_SaveAutoAddnew; //ä¿ååå为æ°å¢ç¶æ |
| | | public string QC_FirstPieceCheckBill_DeleterAndMakerMustSame; //å é¤äººå¿
é¡»æ¯å¶å人 |
| | | public string QC_FirstPieceCheckBill_QCSchemeSource; //è´¨æ£æ¹æ¡æ¥æº |
| | | |
| | | //å·¡æ£å |
| | | |
| | | public string QC_PatrolProcCheckBill_AutoCheck; //ä¿å忝å¦èªå¨å®¡æ ¸ |
| | | public string QC_PatrolProcCheckBill_SaveAutoAddnew; //ä¿ååå为æ°å¢ç¶æ |
| | | public string QC_PatrolProcCheckBill_DeleterAndMakerMustSame; //å é¤äººå¿
é¡»æ¯å¶å人 |
| | | public string QC_PatrolProcCheckBill_QCSchemeSource; //è´¨æ£æ¹æ¡æ¥æº |
| | | |
| | | //å·¥åºè½¬åºæ£éªå |
| | | |
| | | public string QC_ProcessCheckBill_AutoCheck; //ä¿å忝å¦èªå¨å®¡æ ¸ |
| | | public string QC_ProcessCheckBill_SaveAutoAddnew; //ä¿ååå为æ°å¢ç¶æ |
| | | public string QC_ProcessCheckBill_DeleterAndMakerMustSame; //å é¤äººå¿
é¡»æ¯å¶å人 |
| | | public string QC_ProcessCheckBill_QCSchemeSource; //è´¨æ£æ¹æ¡æ¥æº |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string sErrMsg = ""; |
| | | oSystemParameter.ShowBill(ref sErrMsg); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | |
| | | int IsProNo = mainList[0].IsProNo;//æ¯å¦è½¬å·¥åº |
| | | HName_LongShan = mainList[0].HName;//å·¥èºè·¯çº¿åç§° |
| | | |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "") |
| | | { |
| | | if (HPicNumVer == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å¾å·çæ¬ä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HPicNumAssemble == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ»è£
å¾å·ä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HMaterTexture == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æè´¨ä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HProductNum == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æåç¼å·ä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HVerNum == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "çæ¬ä¸è½ä¸ºç©º!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (OperationType == 2) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where åæ®å·='" + HBillNo + "'", "h_v_Gy_RoutingBillList"); |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sErrMsg = ""; |
| | | if (oSystemParameter.ShowBill(ref sErrMsg)) |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "çä¸ç¥º") |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "çä¸ç¥º") |
| | | { |
| | | if (oSystemParameter.omodel.Gy_RoutingBill_SaveAutoLastProc == "Y" && OperationType == 1) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Gy_Process Where HTProcessFlag = 1 and HNumber='9999' ", "Gy_Process"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æªè®¾ç½®è½¬å·¥åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //è®¾ç½®è½¬å·¥åº |
| | | oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID); |
| | | } |
| | | } |
| | | else if (IsProNo == 1 && OperationType == 1) |
| | | if (oSystemParameter.omodel.Gy_RoutingBill_SaveAutoLastProc == "Y" && OperationType == 1) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Gy_Process Where HTProcessFlag = 1 and HNumber='9999' ", "Gy_Process"); |
| | | |
| | |
| | | oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID); |
| | | } |
| | | } |
| | | else if (IsProNo == 1 && OperationType == 1) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Gy_Process Where HTProcessFlag = 1 and HNumber='9999' ", "Gy_Process"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æªè®¾ç½®è½¬å·¥åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //è®¾ç½®è½¬å·¥åº |
| | | oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID); |
| | | } |
| | | |
| | | |
| | | |
| | | //æ¯å¦å¾éé»è®¤å·¥èºè·¯çº¿ |
| | |
| | | { |
| | | try |
| | | { |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql1 = "select * from h_v_Sc_AssemblyBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_AssemblyBillList"); |
| | | |
| | | //æ·»å åå |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_AssemblyBillList " + sWhere, "h_v_Sc_AssemblyBillList"); |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//è·åå°DataColumnå对象çåå |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Sc_AssemblyBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_AssemblyBillList"); |
| | | } |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "falseï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | #region ææè®¡åå ææè®¡åæ¥è¡¨ |
| | | [Route("JIT_Cg_PODemandPlanBill/ReportPODemandPlanBillList_S")] |
| | | [HttpGet] |
| | | public object ReportPODemandPlanBillList_S(string sWhere, string user) |
| | | public object ReportPODemandPlanBillList_S(string sWhere, string user,string HBEGINDATE,string HENDDATE) |
| | | { |
| | | try |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_PODemandPlanBill_S_ReportList '{sWhere.ToString()}' ", "h_p_JIT_PODemandPlanBill_S_ReportList"); |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_PODemandPlanBill_S_ReportList '{sWhere.ToString()}','{HBEGINDATE}','{HENDDATE}' ", "h_p_JIT_PODemandPlanBill_S_ReportList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | { |
| | | SumCount += 1; |
| | | ////ä¿åå表 |
| | | |
| | | objJsonResult = AddBillSub(HInterID == 0 ? list[i]["hmainid"].ToString() : HInterID.ToString() |
| | | , HBillNo == "" ? list[i]["åæ®å·"].ToString() : HBillNo |
| | | , DateTime.Parse(DateTime.Now.AddDays(j).ToString("yyyy-MM-dd").ToString()) |
| | | , int.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString())); |
| | | |
| | | , int.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString()) |
| | | , list[i]); |
| | | if (objJsonResult.count == 1) |
| | | { |
| | | TrueCount += 1; |
| | |
| | | //ä¸»è¡¨ææ°æ® åè¡¨æ æ°æ® |
| | | if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "") |
| | | { |
| | | objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0); |
| | | objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0, list[i]); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY) |
| | | public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY, Dictionary<string, string> dic) |
| | | { |
| | | //è·åè¡¨æ ¼æ°æ® |
| | | ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where åæ®å·='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList"); |
| | | |
| | | int count = 0; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | |
| | | { |
| | | if (DateTime.Parse(ds.Tables[0].Rows[i]["æ¥è®¡åçäº§æ¥æ"].ToString()) == date) |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY}" + |
| | | oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["å°æ¶äº§è½"]=="0"?0: HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString()))}" + |
| | | $" where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}"); |
| | | count += 1; |
| | | } |
| | |
| | | { |
| | | //æå
¥å表 |
| | | oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," + |
| | | "HMasterDate,HQty)" + |
| | | "HMasterDate,HQty,HUseTimes)" + |
| | | $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + |
| | | $" '{date}', {HQTY})"); |
| | | $" '{date}', {HQTY},{(dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString()))})"); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | |
| | | using System; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | |
| | | Int64 sCPMaterID = 0; |
| | | string sCPMaterName = ""; |
| | | private json objjson = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | //æ«ææåæ¡ç |
| | | [Route("Assembly/Get_Assembly_CPBarCode_Json")] |
| | |
| | | } |
| | | |
| | | |
| | | #region 产线ç»è£
追溯å |
| | | [Route("Sc_AssemblyBill/HBardCodeList")] |
| | | [HttpGet] |
| | | public object HBardCodeList(string HBarCode, string user,string HICMOBillNo) |
| | | { |
| | | try |
| | | { |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_AssemblyBill_Edit", 1, false, user)) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "æ ä¿åæéï¼"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | if (HICMOBillNo == "" || HICMOBillNo == null) |
| | | { |
| | | ds = oCN.RunProcReturn(@"select bard.HSourceInterID,bard.HSourceEntryID,b.FMUSTQTY,a.FMOBILLNO,FERPCLSID,t5.FNAME HMaterName_z,t5.FSPECIFICATION HMaterModel_z ,m.HItemID,b.FMATERIALID,m.HName HMaterName,m.HNumber HMaterNumber,m.HModel HMaterModel,m1.HItemID HMaterID |
| | | from AIS20210811135644..T_PRD_PPBOM a |
| | | join AIS20210811135644..T_PRD_PPBOMENTRY b on a.FID = b.FID |
| | | join AIS20210811135644..T_BD_MATERIAL t3 on a.FMATERIALID = t3.FMATERIALID |
| | | join AIS20210811135644..T_BD_MATERIAL t31 on b.FMATERIALID = t31.FMATERIALID |
| | | join AIS20210811135644..T_BD_MATERIAL_L t5 on b.FMATERIALID = t5.FMATERIALID and FLOCALEID=2052 |
| | | join AIS20210811135644..t_BD_MaterialBase t4 on t5.FMATERIALID = t4.FMATERIALID |
| | | join Gy_BarCodeBill bard on a.FMOBILLNO=bard.HSourceBillNo |
| | | join Gy_Material m on bard.HMaterID=m.HItemID and t3.FNUMBER=m.HNumber |
| | | join Gy_Material m1 on t31.FNUMBER=m1.HNumber and t31.FUSEORGID=m1.HUSEORGID |
| | | where bard.HBarCode='" + HBarCode + "' AND t4.FERPCLSID in ('1', '3')", "Gy_BarCodeBill"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "请å
æ«äº§åæ¡ç ï¼"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | else |
| | | { |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = ""; |
| | | objjson.data = ds.Tables[0]; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn(@"select a.FMOBILLNO,FERPCLSID ,t4.FMATERIALID, a.FMATERIALID from AIS20210811135644..T_PRD_PPBOM a |
| | | join AIS20210811135644..T_PRD_PPBOMENTRY b on a.FID=b.FID |
| | | JOIN AIS20210811135644..T_BD_MATERIAL T6 ON b.FMATERIALID = T6.FMATERIALID |
| | | join AIS20210811135644..t_BD_MaterialBase t4 on b.FMATERIALID = t4.FMATERIALID |
| | | left join Gy_Material m on t6.FNUMBER=m.HNumber and m.HUSEORGID=a.FPRDORGID |
| | | where a.FMOBILLNO ='" + HICMOBillNo + "' and m.HItemID=(select HMaterID from Gy_BarCodeBill where HBarCode = '" + HBarCode + "' )", "ds2"); |
| | | |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "é
ä»¶ä¸å±äºè¯¥ç产订åï¼"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn(@"select HQty,HSourceBillNo,m.HName HMaterName,m.HItemID HMaterID from Gy_BarCodeBill bard |
| | | join Gy_Material m on bard.HMaterID=m.HItemID |
| | | where HBarCode='" + HBarCode + "'", "ds3"); |
| | | |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = ""; |
| | | objjson.data = ds.Tables[0]; |
| | | } |
| | | return objjson; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "没æè¿åä»»ä½è®°å½ï¼" + e.ToString(); |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 产线ç»è£
追溯åä¿å |
| | | [Route("Sc_AssemblyBill/AddBill")] |
| | | [HttpPost] |
| | | public object AddBill([FromBody] JObject sMainSub) |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCN.BeginTran(); |
| | | //ä¿å主表 |
| | | objjson = AddBillMain(msg1); |
| | | if (objjson.code == "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = objjson.Message; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | oCN.Commit(); |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = "æ°å¢åæ®æåï¼"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | Models.ClsSc_AssemblyBillMain omodel = new Models.ClsSc_AssemblyBillMain();//åºæ¬èµæ |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | int OperationType = int.Parse(sArray[2].ToString());//ç±»å |
| | | string user = sArray[3].ToString();//ç¨æ·å |
| | | |
| | | try |
| | | { |
| | | //夿æ¯å¦æç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_AssemblyBill_Edit", 1, false, user)) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "æ æéç¼è¾!"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | omodel = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_AssemblyBillMain>(msg2); |
| | | //JSONåºåå转æ¢åå
¸éå |
| | | List<Dictionary<string, string>> list = new List<Dictionary<string, string>>(); |
| | | List<object> jb = JsonConvert.DeserializeObject<List<object>>(msg3); |
| | | foreach (JObject item in jb) |
| | | { |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | foreach (var itm in item.Properties()) |
| | | { |
| | | dic.Add(itm.Name, itm.Value.ToString()); |
| | | } |
| | | list.Add(dic); |
| | | } |
| | | |
| | | if (OperationType == 1)//æ°å¢ä¸´æ¶è¡¨æºå表 |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | //临æ¶é
件表 |
| | | oCN.RunProc("Insert Into Sc_AssemblyBill_BindSourceTemp " + |
| | | "(HInterID,HEntryID,HBillNo_bak,HSourceBillNo,HSourceInterID,HMaterID" + |
| | | ",HQtyMust,HProdOrgID,HSourceEntryID,HSourceBillType,HAuxPropID,HProcID,HQty,HBatchNo,HMTONo,HPlanMode) " + |
| | | " values(" + omodel.HInterID.ToString() + "," + (i+1) + ",'" + omodel.HBillNo.ToString() + "','" + omodel.HICMOBillNo.ToString() + "',0," + list[i]["HMaterID"].ToString() + |
| | | ",'" + list[i]["HQty"].ToString() + "','" + list[i]["HPRDORGID"].ToString() + "',0,'',0,0,0,'','','') "); |
| | | } |
| | | } |
| | | else if (OperationType == 2)//æ°å¢é
ä»¶æ«ç 表 |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | if (list[i]["HBarCode"].ToString() != "") |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Sc_AssemblyBill_BindBarCodeTemp where HSourceBillNo='" + omodel.HICMOBillNo.ToString() + "' and HBarCode='" + list[i]["HBarCode"].ToString() + "' and HBillNo_bak='" + omodel.HBillNo.ToString() + "'", "Sc_AssemblyBill_BindBarCodeTemp"); |
| | | if (ds.Tables[0].Rows.Count > 0) { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message ="该æ¡ç å·²æ«å
¥,æ 须快!"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | //临æ¶è®°å½è¡¨ |
| | | oCN.RunProc("Insert Into Sc_AssemblyBill_BindBarCodeTemp " + |
| | | "(HInterID,HEntryID,HBillNo_bak,HSourceBillNo,HSourceInterID,HMaterID" + |
| | | ",HBarCode,HQty,HProdOrgID,HSourceEntryID,HSourceBillType,HAuxPropID,HProcID,HBatchNo,HMTONo,HPlanMode) " + |
| | | " values(" + omodel.HInterID.ToString() + "," + (i + 1) + ",'" + omodel.HBillNo.ToString() + "','" + omodel.HICMOBillNo.ToString() + "',0," + list[i]["HMaterID"].ToString() + |
| | | ",'" + list[i]["HBarCode"].ToString() + "','" + list[i]["HEQty"].ToString() + "','" + list[i]["HPRDORGID"].ToString() + "',0,'',0,0,'','','') "); |
| | | } |
| | | } |
| | | } |
| | | else if (OperationType == 3)//æ°å¢ä¸»å表 |
| | | { |
| | | //ä¿åç产ç»è£
å主表 |
| | | string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate |
| | | ,HBillNo,HBillStatus,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo |
| | | ,HICMOInterID,HICMOBillNo,HBarCode_P,HMaterID,HUnitID,HAssemblyStatus,HProdOrgID) |
| | | values('{DateTime.Now.Year}','{DateTime.Now.Month}','3727','3727',{omodel.HInterID.ToString()},getdate() |
| | | ,'{omodel.HBillNo.ToString()}','1','{user}',getdate(),{omodel.HICMOInterID.ToString()},{omodel.HICMOEntryID.ToString()},'{omodel.HICMOBillNo.ToString()}' |
| | | ,{omodel.HICMOInterID.ToString()},'{omodel.HICMOBillNo.ToString()}','{omodel.HBarCode_P.ToString()}',{omodel.HMaterID},0,'{omodel.HAssemblyStatus}',{omodel.HProdOrgID})"; |
| | | oCN.RunProc(sql); |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_AssemblyBill_BindBarCodeTemp where HSourceBillNo='" + omodel.HICMOBillNo.ToString() + "' and HInterID='" + omodel.HInterID + "' and HBillNo_bak='" + omodel.HBillNo.ToString() + "'", "Sc_AssemblyBill_BindBarCodeTemp"); |
| | | |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | | int HMaterID = int.Parse(ds.Tables[0].Rows[i]["HMaterID"].ToString()); |
| | | double HQty = double.Parse(ds.Tables[0].Rows[i]["HQty"].ToString()); |
| | | string HBarCode = ds.Tables[0].Rows[i]["HBarCode"].ToString(); |
| | | string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo |
| | | ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty |
| | | ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber) |
| | | values({omodel.HInterID},'{omodel.HBillNo}',{(i + 1)},0,0,'' |
| | | ,'',{HMaterID},0,0,0,{HQty} |
| | | ,0,0,getdate(),'{HBarCode}','{omodel.HBarCode_P}','') "; |
| | | oCN.RunProc(sq2); |
| | | } |
| | | } |
| | | |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = null; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "Exceptionï¼" + e.ToString(); |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 产线ç»è£
è¿½æº¯å æ¥è¯¢ |
| | | [Route("Sc_AssemblyBill/Sc_AssemblyBillAddList")] |
| | | [HttpGet] |
| | | public object Sc_AssemblyBillAddList(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn(@"select * from h_v_Sc_AssemblyBillList where 1=1 " + sWhere, "h_v_Sc_AssemblyBillList"); |
| | | |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = ""; |
| | | objjson.data = ds.Tables[0]; |
| | | return objjson; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "没æè¿åä»»ä½è®°å½ï¼" + e.ToString(); |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | [Route("Assembly/Delete_Json")] |
| | | [HttpGet] |
| | |
| | | { |
| | | try |
| | | { |
| | | string sErr = ""; |
| | | oSystemParameter.ShowBill(ref sErr); |
| | | |
| | | |
| | | //è·åçäº§æ±æ¥åæå¤§InterIDååæ®å· |
| | | Int64 HInterID = DBUtility.ClsPub.CreateBillID("3711", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo = DBUtility.ClsPub.CreateBillCode("3711", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | |
| | | FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// ææ¬æé |
| | | FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// åå²é¢æ |
| | | FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());// |
| | | //FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //å
è£
æ è¯ |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "çä¸ç¥º") |
| | | { |
| | | FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() });//å
è£
æ è¯ |
| | | } |
| | | FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //æ¹å· |
| | | FentityModel.Add("F_bsv_Text", dr1["å·¥åºæµè½¬å¡å·"].ToString()); //æµè½¬å¡å· |
| | | JArray Fentity2 = new JArray(); |
| | |
| | | //ç©æä»£ç -å
è£
æ è¯-æ¥æ-ä¾åºå代ç -å
«ä½æµæ°´å· |
| | | LSHlen = 8;//æµæ°´å·æ¯8ä½ |
| | | |
| | | DataSet dataDs = oCN.RunProcReturn($"select b.F_TEZV_BASE from AIS20220308151944..T_PUR_Receive a inner join AIS20220308151944..T_PUR_RECEIVEENTRY b on a.FID = b.FID where a.FID={ordrlist[j].HMainID} and b.FENTRYID={ordrlist[j].HSubID}", "T_PUR_Receive"); |
| | | DataSet dataDs = oCN.RunProcReturn($@"select isnull(pr.FNUMBER,'') F_TEZV_BASE from AIS20220308151944..T_PUR_Receive a |
| | | inner join AIS20220308151944..T_PUR_RECEIVEENTRY b on a.FID = b.FID |
| | | left join AIS20220308151944..T_BAS_PREBDONE pr on b.F_TEZV_BASE=pr.FID |
| | | where a.FID={ordrlist[j].HMainID} and b.FENTRYID={ordrlist[j].HSubID}", "T_PUR_Receive"); |
| | | if (dataDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | { |
| | | //ç©æä»£ç -å
è£
æ è¯-æ¥æ-ç»ç»ä»£ç -å
«ä½æµæ°´å· |
| | | LSHlen = 8;//æµæ°´å·æ¯8ä½ |
| | | |
| | | DataSet dataDs = oCN.RunProcReturn($"select b.F_bsv_Base1,a.FPRDORGID from AIS20220308151944..T_PRD_INSTOCK a inner join AIS20220308151944..T_PRD_INSTOCKENTRY b on a.FID = b.FID where a.FID={ordrlist[j].HMainID} and b.FENTRYID={ordrlist[j].HSubID}", "T_PRD_INSTOCK"); |
| | | DataSet dataDs = oCN.RunProcReturn($@"select isnull(pr.FNUMBER,'') F_bsv_Base1,a.FPRDORGID from AIS20220308151944..T_PRD_INSTOCK a |
| | | inner join AIS20220308151944..T_PRD_INSTOCKENTRY b on a.FID = b.FID |
| | | join( |
| | | select HERPInterID, HERPEntryID, HInterID, HEntryID from Kf_ICStockBillSub |
| | | )kf on b.FID = kf.HERPInterID and b.FENTRYID = kf.HERPEntryID |
| | | left join AIS20220308151944..T_BAS_PREBDONE pr on b.F_bsv_Base1=pr.FID |
| | | where kf.HInterID = {ordrlist[j].HMainID} and kf.HEntryID = {ordrlist[j].HSubID}", "T_PRD_INSTOCK"); |
| | | if (dataDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | ds = oCN.RunProcReturn("select * from Sc_ICMOBillWorkQtyStatus_Tmp where HInterID=" + HInterID + " and HSourceInterID=" + HICMOInterID + " and HSourceEntryID=" + HICMOEntryID, "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | if (ds.Tables[0].Rows.Count == 0) { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥æ æ°æ®!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | //å é¤äº§éæ±æ¥è¡¨ |
| | | string sql = string.Format(@"delete Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "'"); |
| | | oCN.RunProc(sql); |
| | | double sumqty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString()) + double.Parse(ds.Tables[0].Rows[0]["HBadQty"].ToString()) + double.Parse(ds.Tables[0].Rows[0]["HWasterQty"].ToString()); //æ±æ¥æ°é+ä¸è¯+æ¥åº |
| | | //ååçäº§ç¶æä¸´æ¶è¡¨Sc_ICMOBillStatus_Tmpæåæ±æ¥æ°é HSplitRelationQty |
| | | oCN.RunProc("update Sc_ICMOBillStatus_Tmp set HSplitRelationQty=HSplitRelationQty-" + sumqty + " where HICMOBillNo='" + ds.Tables[0].Rows[0]["HICMOBillNo"].ToString() + "' and HSourceID='" + ds.Tables[0].Rows[0]["HSourceID"].ToString() + "' and HICMOInterID='" + ds.Tables[0].Rows[0]["HICMOInterID"].ToString() + "' and HICMOEntryID='" + ds.Tables[0].Rows[0]["HICMOEntryID"].ToString() + "' and HInterID=" + ds.Tables[0].Rows[0]["HSourceInterID"].ToString()); |
| | | |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | |
| | | public string HPCrux; |
| | | public string HSCZY; |
| | | public int HSCZYID; |
| | | public int HProdOrgID; //ç»ç» |
| | | public int HICMOEntryID; //ä»»å¡ååID |
| | | } |
| | | } |