| | |
| | | public static DataSet Sc_GetMESProductReportBillList(string sWhere) |
| | | { |
| | | string sql = string.Format(@"select a.HInterID, a.HBillNo,a.HDate,a.HBillType,a.HBillStatus,a.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,m.HModel HMaterSpec |
| | | ,a.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName |
| | | ,a.HWorkManID,e.HName HWorkManName,a.HMaker,a.HMakeDate, a.HReportType |
| | | ,a.HQty,a.HICMOBillNo,a.HICMOInterID,a.HICMOEntryID |
| | | ,a.HSourceInterID,a.HSourceEntryID,a.HSourceBillNo, a.HSourceBillType |
| | | from Sc_ICMOBillWorkQtyStatus_Tmp a |
| | | left join Gy_Material m on a.HMaterID=m.hitemid |
| | | left join Gy_Source s on a.HSourceID=s.HItemID |
| | | left join Gy_Group g on a.HGroupID=g.HItemID |
| | | left join Gy_Employee e on a.HWorkManID=e.HItemID " + sWhere + " and HRelationInterID='0'"); |
| | | ,b.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName |
| | | ,b.HEmpID,b.HEmpNumber,e.HName HEmpName,a.HMaker,a.HMakeDate, 'å·¥åºæ±æ¥' HReportType |
| | | ,b.HQty,a.HICMOBillNo,a.HICMOInterID,pr.HProcNo,b.HProcID,p.HNumber HProcNumber,p.HName HProcName |
| | | ,b.HSourceInterID,b.HSourceEntryID,b.HSourceBillNo,b.HSourceBillType |
| | | from Sc_ProcessReportMain a |
| | | inner join Sc_ProcessReportSub b on a.HInterID=B.HInterID |
| | | inner join (select max(HProcNo) HProcNo,HBillNo,HProcID,HSourceInterID,HSourceEntryID,HSourceBillNo |
| | | from Sc_ProcessPlanSub group by HBillNo,HProcID,HSourceInterID,HSourceEntryID,HSourceBillNo) |
| | | pr on b.HSourceBillNo=pr.HSourceBillNo and b.HSourceInterID=pr.HSourceInterID and b.HSourceEntryID=pr.HSourceEntryID |
| | | left join Gy_Process p on b.HProcID=p.HItemID |
| | | left join Gy_Material m on a.HMaterID=m.hitemid |
| | | left join Gy_Source s on b.HSourceID=s.HItemID |
| | | left join Gy_Group g on a.HGroupID=g.HItemID |
| | | left join Gy_Employee e on b.HEmpID=e.HItemID "+sWhere+" and HRelationInterID='0'"); |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | try |
| | | { |
| | | ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadQty),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty from Sc_ICMOBillWorkQtyStatus_Tmp with (nolock)" + sWhere, "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadQty),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty from Sc_ProcessReportSub with (nolock)" + sWhere, "Sc_ProcessReportSub"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥å·¥å¹³å°äº§éæ±æ¥ä¿å/ç¼è¾ |
| | | #region æ¥å·¥å¹³å°å·¥åºæ±æ¥ä¿å/ç¼è¾ |
| | | /// <summary> |
| | | /// å¼å·¥å |
| | | /// å·¥åºæ±æ¥æäº¤ |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp(); |
| | | List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp> lsmain = new List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp>(); |
| | | DLL.ClsSc_ProcessReport oBill = new DLL.ClsSc_ProcessReport(); |
| | | List<Models.ClsSc_ProcessReportMain> lsmain = new List<Models.ClsSc_ProcessReportMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MESProductReportFrom(msg2); |
| | | foreach (Models.ClsSc_ICMOBillWorkQtyStatus_Tmp oItem in lsmain) |
| | | lsmain = oListModels.getObjectByJson_ProcessReportMain(msg2); |
| | | foreach (Models.ClsSc_ProcessReportMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | oItem.HBillType = "3724"; |
| | | oItem.HBillSubType = "3724"; |
| | | oItem.HReportType = 3;//ï¼1æ¡ç æ«æï¼2æºå¨æ±æ¥ï¼3æå·¥å½å
¥ï¼ |
| | | oItem.HBillType = "3714"; |
| | | oItem.HBillSubType = "3714"; |
| | | oItem.HBillStatus = 1; //åæ®ç¶æï¼1æªå®¡ï¼2å®¡æ ¸éè¿ï¼3å
³éï¼4ä½åºï¼5å®¡æ ¸éå,6å®¡æ ¸ä¸,7å·²é
ï¼8å·²åå¤ï¼9ç»æ¡ï¼10éªè¯,11ä¸è¾¾ï¼12å¼å·¥,13ç³è¯·å®¡æ¹,15ç³è¯·æ£éªï¼16 å¤å®åæ ¼ï¼17å¤å®ä¸åæ ¼ï¼ |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //è¡¨ä½æ°æ® |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | List<Models.ClsSc_ProcessReportSub> ls = new List<Models.ClsSc_ProcessReportSub>(); |
| | | ls = oListModels.getObjectByJson_ProcessReportSub(msg2); |
| | | int i = 0; |
| | | foreach (Models.ClsSc_ProcessReportSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | //oItemSub.HCloseMan = ""; //è¡å
³é |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //å
³éç±»å |
| | | //oItemSub.HRemark = ""; //夿³¨ |
| | | oItemSub.HRelationQty = 0; //å
³èæ°é |
| | | //oItemSub.HRelationMoney = 0; //å
³èéé¢ |
| | | //oItemSub.HRepairID = 0; //ç»´ä¿®é¡¹ç® |
| | | //oItemSub.HRepairExplanation =""; //ç»´ä¿®è¦æ± |
| | | //oItemSub.HManagerID = 0; //è´è´£äººID |
| | | //oItemSub.HMoney = 0; //ç»´ä¿®è´¹ç¨ |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //ä¿å |
| | |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.Sc_ICMOBillWorkQtyStatus_AutoCheck == "Y") //ç³»ç»åæ° èªå¨å®¡æ ¸ |
| | | if (oSystemParameter.omodel.Sc_MESProceReportWorkBill_AutoCheck == "Y") //ç³»ç»åæ° èªå¨å®¡æ ¸ |
| | | { |
| | | objJsonResult.Verify = "Y"; |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥å·¥å¹³å°äº§éæ±æ¥å®¡æ ¸ãåå®¡æ ¸ |
| | | #region æ¥å·¥å¹³å°å·¥åºæ±æ¥å®¡æ ¸ãåå®¡æ ¸ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | [HttpGet] |
| | | public object MESProductAuditProcessReportList(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "MES_ProcExchReport_Check"; |
| | | string ModRightNameCheck = "MES_ProductReport_Check"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | |
| | | } |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp(); |
| | | DLL.ClsSc_ProcessReport oBill = new DLL.ClsSc_ProcessReport(); |
| | | //æ¥çæ¯å¦å·²å®¡æ ¸,å
³é,ä½åº |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | |
| | | if (IsAudit == 0) //å®¡æ ¸æäº¤ |
| | | { |
| | | //å®¡æ ¸æäº¤ |
| | | if (oBill.CheckBill(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | if (IsAudit == 1) //åå®¡æ ¸æäº¤ |
| | | { |
| | | //åå®¡æ ¸æäº¤AbandonCheck |
| | | if (oBill.AbandonCheck(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | //æ¥è¯¢äº§éæ±æ¥ä¸´æ¶è¡¨æ°é |
| | | ds = oCN.RunProcReturn("select isnull(HQty,0) HQty,isnull(HWasterQty,0) HWasterQty,isnull(HBadQty,0) HBadQty from Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "' and HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'", "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | double HQty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString()); |
| | | double HWasterQty = double.Parse(ds.Tables[0].Rows[0]["HWasterQty"].ToString()); |
| | | double HBadQty = double.Parse(ds.Tables[0].Rows[0]["HBadQty"].ToString()); |
| | | double sumqty = HQty + HBadQty + HWasterQty; //æ±æ¥æ°é+ä¸è¯+æ¥åº |
| | | //æ´æ°äº§éè£
é临æ¶è¡¨å·²æ±æ¥æ°é |
| | | string sql1 = string.Format(@"update Sc_ICMOBillStatus_Tmp set HICMOStatus='1',HFinishFlag='0', HRelationInterID=0,HSplitRelationQty=HSplitRelationQty-" + sumqty + ",HDateFinishQty=HDateFinishQty-" + sumqty + " where HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'"); |
| | | //å é¤å·¥åºæ±æ¥å表 |
| | | string sql1 = string.Format(@"delete Sc_ProcessReportSub where HInterID='"+HInterID+"' and HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'"); |
| | | oCN.RunProc(sql1); |
| | | //æ´æ°åæ¢ç¶æå¼ |
| | | string sql = string.Format(@"delete Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "'"); |
| | | //å é¤å·¥åºæ±æ¥ä¸»è¡¨ |
| | | string sql = string.Format(@"delete Sc_ProcessReportMain where HInterID='" + HInterID + "'"); |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.Commit(); |