| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Web; |
| | | |
| | |
| | | oCn.RunProc("Insert Into Sc_ProcessPlanSub " + |
| | | "(HInterID,HEntryID,HBillNo" + |
| | | ",HICMOInterID,HICMOBillNo,HProcNo,HProcID" + |
| | | ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate" + |
| | | ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + |
| | | ") " + |
| | | " values(" + omodel.HInterID.ToString() + ",0,'" + omodel.HBillNo + |
| | | "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "','" + omodel.HProcNo + "'," + omodel.HProcID.ToString() + "," + omodel.HGroupID.ToString() + |
| | | "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() + |
| | | "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() + "'," + omodel.HSourceInterID.ToString() + |
| | | "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSourceBillType + |
| | | "') "); |
| | | sReturn = "修改单据成功!"; |
| | | oCn.Commit(); |
| | |
| | | { |
| | | try |
| | | { |
| | | //获取当前工序工序号以及判断是否末道工序 |
| | | //string sql = string.Format(@"select max(b.HProcNo) HProcNo from Sc_ProcessPlanMain a |
| | | // inner join Sc_ProcessPlanSub b on a.HInterID=b.HInterID |
| | | // where b.HSourceBillNo='" + omodel.HSourceBillNo+"' and b.HSourceInterID='"+omodel.HSourceInterID+"' and b.HSourceEntryID='"+omodel.HSourceEntryID+"'"); |
| | | //DataSet ds= oCn.RunProcReturn(sql, "Sc_ProcessPlanMain"); |
| | | //查询最大工序及判断当前工序是否小于最大工序 |
| | | //if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HProcNo"].ToString()) > omodel.HProcID) |
| | | //{ |
| | | // omodel.HProcNo = omodel.HProcNo + 5; |
| | | //} |
| | | //else |
| | | //{ |
| | | // omodel.HProcNo = omodel.HProcNo + 5; //末道工序序号加5 |
| | | //} |
| | | |
| | | //得到mainid |
| | | omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //若MAINDI重复则重新获取 |
| | |
| | | oCn.RunProc("Insert Into Sc_ProcessPlanSub " + |
| | | "(HInterID,HEntryID,HBillNo" + |
| | | ",HICMOInterID,HICMOBillNo,HProcNo,HProcID" + |
| | | ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate" + |
| | | ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSourceID" + |
| | | ") " + |
| | | " values(" + omodel.HInterID.ToString() + ",0,'" + omodel.HBillNo + |
| | | "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "','" + omodel.HProcNo + "'," + omodel.HProcID.ToString() + "," + omodel.HGroupID.ToString() + |
| | | "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() + |
| | | "') "); |
| | | "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() +"',"+ omodel.HSourceInterID.ToString()+ |
| | | ","+ omodel.HSourceEntryID.ToString()+",'"+ omodel.HSourceBillNo+"','"+ omodel.HSourceBillType+","+ omodel.HSourceID.ToString()+ |
| | | ") "); |
| | | //新增生产状态临时表 |
| | | string sql1 = string.Format(@"insert into Sc_ICMOBillStatus_Tmp(HYear,HPeriod,HBillType,HDate,HDeptID,HICMOInterID,HICMOEntryID,HICMOBillNo,HYX,HSplitNO,HICMOStatus,HMaterID |
| | | ,HMaterNumber,HUnitID,HUnitNumber,HSourceID,HSourceNumber,HSplitPlanQty,HSplitRelationQty,HDatePlanQty |
| | | ,HUnitFinishQty,HDateFinishQty,HBadQty,HUnitBadQty,HWasterQty,HSumTimes,HFinishFlag,HCurWorkFlag,HCurQualityFlag |
| | | ,HBeginDate,HEndDate,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo |
| | | ,HSourceBillType,HRelationInterID,HEnoughMaterFlag,HProcID,HPlanQty) |
| | | select HYear,HPeriod,HBillType,HDate,HDeptID,HICMOInterID,HICMOEntryID,HICMOBillNo,HYX,HSplitNO,HICMOStatus,HMaterID |
| | | ,HMaterNumber,HUnitID,HUnitNumber,HSourceID,HSourceNumber,HPlanQty,HSplitPlanQty,HSplitRelationQty,HDatePlanQty |
| | | ,HUnitFinishQty,HDateFinishQty,HBadQty,HUnitBadQty,HWasterQty,HSumTimes,HFinishFlag,HCurWorkFlag,HCurQualityFlag |
| | | ,HBeginDate,HEndDate,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo |
| | | ,HSourceBillType,HRelationInterID,HEnoughMaterFlag,HProcID,'"+omodel.HQty.ToString()+"' " + |
| | | "from Sc_ICMOBillStatus_Tmp where HSourceBillNo='"+omodel.HSourceBillNo.ToString()+"'" + |
| | | " and HSourceInterID='"+omodel.HSourceInterID+"' and HSourceEntryID='"+omodel.HMainSourceEntryID.ToString()+"'" + |
| | | " and HSourceID='"+omodel.HSourceID.ToString()+"' and HProcID='"+omodel.HProcID.ToString()+"'"); |
| | | oCn.RunProc(sql); |
| | | sReturn = "新增单据成功!"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | throw (e); |
| | | } |
| | | } |
| | | |
| | | //审核 |
| | | public bool CheckBill(Int64 lngBillKey, ref string sReturn) |
| | | { |
| | | try |
| | | { |
| | | string HChecker = DBUtility.ClsPub.CurUserName; |
| | | string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); |
| | | //更新工序计划单审核人、审核时间 |
| | | oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); |
| | | //更新(工序汇报单、生产状态临时表)不良数量=不良数量-返工数量 |
| | | sReturn = ""; |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sReturn = e.Message; |
| | | throw (e); |
| | | } |
| | | } |
| | | |
| | | //反审核 |
| | | public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) |
| | | { |
| | | |
| | | if (isUse(lngBillKey, ref sReturn)) |
| | | { |
| | | return false; |
| | | } |
| | | try |
| | | { |
| | | oCn.RunProc(" Update " + MvarItemKey + " set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); |
| | | //更新(工序汇报单、生产状态临时表)不良数量=不良数量-返工数量 |
| | | sReturn = ""; |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sReturn = e.Message; |
| | | throw (e); |
| | | } |
| | | } |
| | | } |
| | | } |