public void WriteHistory(string eventName, string eventGroup,string customerid, string custOrderNo, string cartonNo, string styleNo, string color, string size, decimal cartonQty, decimal? pairQty, string refSysId, string remark) { tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = customerid; history.cartonno = cartonNo; history.cartonqty = cartonQty; history.color = color; history.custorderno = custOrderNo; history.eventgroup = eventGroup; history.eventname = eventName; history.pairqty = pairQty; history.refsysid = refSysId; history.remark = remark; history.size = size; history.styleno = styleNo; history.eventtime = Function.GetCurrentTime(); history.eventuser = Function.GetCurrentUser(); history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; baseDal.DoInsert<tinpcustorderhistory>(history); }
public void WriteHistory(tinpcustorderhistory history) { history.eventtime = Function.GetCurrentTime(); history.eventuser = Function.GetCurrentUser(); history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; baseDal.DoInsert<tinpcustorderhistory>(history); }
public void DoSupplement(tinpsupplement supplement, List<tinpsupplementdtl> lstsupplementdtl) { try { dbInstance.BeginTransaction(); baseDal.DoInsert(supplement); string eventgroup = Function.GetGUID(); foreach (tinpsupplementdtl supplementdtl in lstsupplementdtl) { supplementDtlDal.DoInsert(supplementdtl); #region Update WIP wipDal.SaveOrUpdate(supplementdtl.customerid, supplementdtl.custorderno, supplementdtl.styleno, supplementdtl.color, supplementdtl.size, supplement.step, supplement.workgroup, Convert.ToInt16(supplementdtl.pairqty), supplementdtl.checktype); #endregion #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = supplementdtl.customerid; history.cartonno = ""; history.cartonqty = 0; history.custorderno = supplementdtl.custorderno; history.size = supplementdtl.size; history.styleno = supplementdtl.styleno; history.color = supplementdtl.color; history.eventgroup = eventgroup; history.eventname = "Supplement"; history.pairqty = supplementdtl.pairqty; history.refsysid = supplementdtl.supldtlsysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion } dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
public void DoReturn(tinpreturn inpreturn, List<tinpreturndtl> lstreturndtl) { try { dbInstance.BeginTransaction(); var sumqty = lstreturndtl.Select(p => p.pairqty).Sum(); List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="retsysid",ParamValue=inpreturn.retsysid} }; List<tinpreturn> lstreturn = baseDal.GetSelectedObjects<tinpreturn>(lstParams); if (lstreturn.Count > 0) { List<tinpreturndtl> lstdtl = baseDal.GetSelectedObjects<tinpreturndtl>(lstParams); foreach (tinpreturndtl dtl in lstdtl) { wipDal.SaveOrUpdate(dtl.customerid,dtl.custorderno, dtl.styleno, dtl.color, dtl.size, MES_WIPStatus.BAD.ToString(), MES_Misc.BadStock.ToString(), Convert.ToInt16(dtl.pairqty),dtl.checktype); returnDtlDal.DoDelete<tinpreturndtl>(dtl); } if (sumqty.Value == 0) { baseDal.DoDelete<tinpreturn>(inpreturn); } } else { if (sumqty.Value > 0) { baseDal.DoInsert(inpreturn); } } string eventgroup=Function.GetGUID(); foreach (tinpreturndtl returndtl in lstreturndtl) { if (returndtl.pairqty > 0) { returnDtlDal.DoInsert(returndtl); #region Update WIP wipDal.SaveOrUpdate(returndtl.customerid, returndtl.custorderno, returndtl.styleno, returndtl.color, returndtl.size, MES_WIPStatus.BAD.ToString(), MES_Misc.BadStock.ToString(), Convert.ToInt16(-returndtl.pairqty),returndtl.checktype); #endregion #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = inpreturn.customerid; history.cartonno = ""; history.cartonqty = 0; history.custorderno = returndtl.custorderno; history.size = returndtl.size; history.styleno = returndtl.styleno; history.color = returndtl.color; history.eventgroup = eventgroup; history.eventname = "Return"; history.pairqty = returndtl.pairqty; history.refsysid = returndtl.retdtlsysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion } } dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
/// <summary> /// Create a new tinpcustorderhistory object. /// </summary> /// <param name="ohsysid">Initial value of the ohsysid property.</param> public static tinpcustorderhistory Createtinpcustorderhistory(global::System.String ohsysid) { tinpcustorderhistory tinpcustorderhistory = new tinpcustorderhistory(); tinpcustorderhistory.ohsysid = ohsysid; return tinpcustorderhistory; }
/// <summary> /// Deprecated Method for adding a new object to the tinpcustorderhistory EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotinpcustorderhistory(tinpcustorderhistory tinpcustorderhistory) { base.AddObject("tinpcustorderhistory", tinpcustorderhistory); }
public void DoXUnpacking(List<string[]> lstunpacking) { try { dbInstance.BeginTransaction(); string eventgroup = Function.GetGUID(); List<tinppackingrec> lstpacking = new List<tinppackingrec>(); List<tinppackingrecdtl> lstpackingdtl = new List<tinppackingrecdtl>(); List<tinpreceivingctndtl> lstreceivingctn = new List<tinpreceivingctndtl>(); foreach (string[] strarr in lstunpacking) { List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="customerid",ParamValue=strarr[0]}, new MESParameterInfo(){ParamName="custorderno",ParamValue=strarr[1]}, new MESParameterInfo(){ParamName="cartonno",ParamValue=strarr[2]}, new MESParameterInfo(){ParamName="cartonstatus",ParamValue=MES_CartonStatus.Active.ToString()}, new MESParameterInfo(){ParamName="cartonlocation",ParamValue=MES_CartonLocation.Warehouse.ToString()}, new MESParameterInfo(){ParamName="checktype",ParamValue=MES_WIPStatus.X.ToString()} }; List<tinpreceivingctndtl> lstrec = receivingCtnDtlDal.GetSelectedObjects<tinpreceivingctndtl>(lstParams); foreach (tinpreceivingctndtl rec in lstrec) { var q = from p in lstpacking where p.custorderno.Equals(rec.custorderno) select p; tinppackingrec packing = null; if (q.Count() > 0) { packing = q.ElementAt(0); packing.ttlqty += rec.pairqty; } else { packing = new tinppackingrec(); packing.pksysid = Function.GetGUID(); packing.workgroup = strarr[3]; packing.customerid = strarr[0]; packing.custorderno = rec.custorderno; packing.pktype = MES_PackingType.Unpacking.ToString(); packing.actiondate = Function.GetCurrentTime(); packing.ttlqty = rec.pairqty; lstpacking.Add(packing); } tinppackingrecdtl packingdtl = new tinppackingrecdtl(); packingdtl.pksysid = packing.pksysid; packingdtl.customerid = rec.customerid; packingdtl.custorderno = rec.custorderno; packingdtl.cartonno = rec.cartonno; packingdtl.styleno = rec.styleno; packingdtl.color = rec.color; packingdtl.size = rec.size; packingdtl.pairqty = rec.pairqty; packingdtl.confirmqty = 0; packingdtl.difference = 0; packingdtl.isshipped = MES_Misc.N.ToString(); packingdtl.pktype = MES_PackingType.Unpacking.ToString(); lstpackingdtl.Add(packingdtl); wipDal.SaveOrUpdate(packing.customerid, packingdtl.custorderno, packingdtl.styleno, packingdtl.color, packingdtl.size, MES_WIPStatus.X.ToString(), packing.workgroup, Convert.ToInt16(rec.pairqty), rec.checktype); rec.cartonlocation = MES_CartonLocation.WIP.ToString(); //receivingCtnDtlDal.DoUpdate(rec); lstreceivingctn.Add(rec); #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = packing.customerid; history.cartonno = packingdtl.cartonno; history.cartonqty = packingdtl.pairqty; history.custorderno = packingdtl.custorderno; history.size = packingdtl.size; history.styleno = packingdtl.styleno; history.color = packingdtl.color; history.eventgroup = eventgroup; history.eventname = "XUnpacking"; history.pairqty = packingdtl.pairqty; history.refsysid = packingdtl.pksysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion } } foreach (tinppackingrec packing in lstpacking) { localDal.DoInsert(packing); } foreach (tinppackingrecdtl packingdtl in lstpackingdtl) { packingRecDtlDal.DoInsert(packingdtl); } foreach (tinpreceivingctndtl receivingctn in lstreceivingctn) { receivingCtnDtlDal.DoUpdate(receivingctn); } dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
public void DoInsertRepair(tinprepairhis repairhis,List<tinprepairfail> lstreasoncode) { try { dbInstance.BeginTransaction(); repairHisDal.DoInsert(repairhis); foreach (tinprepairfail repairfail in lstreasoncode) { repairfail.repsysid = repairhis.repsysid; repairFailDal.DoInsert(repairfail); } List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="customerid",ParamValue=repairhis.customerid}, new MESParameterInfo(){ParamName="custorderno",ParamValue=repairhis.custorderno}, new MESParameterInfo(){ParamName="styleno",ParamValue=repairhis.styleno}, new MESParameterInfo(){ParamName="color",ParamValue=repairhis.color}, new MESParameterInfo(){ParamName="size",ParamValue=repairhis.size}, new MESParameterInfo(){ParamName="checktype",ParamValue=repairhis.checktype}, new MESParameterInfo(){ParamName="workgroup",ParamValue=repairhis.workgroup}, new MESParameterInfo(){ParamName="step",ParamValue=repairhis.step} }; List<tinprepairstock> lstRepairStock = baseDal.GetSelectedObjects<tinprepairstock>(lstParams, string.Empty, true, -1); if (lstRepairStock.Count > 0) { tinprepairstock repairStock = lstRepairStock[0]; repairStock.curpairqty = repairStock.curpairqty + repairhis.pairqty; baseDal.DoUpdate(repairStock); } else { tinprepairstock repairStock = new tinprepairstock(); repairStock.customerid = repairhis.customerid; repairStock.custorderno = repairhis.custorderno; repairStock.styleno = repairhis.styleno; repairStock.color = repairhis.color; repairStock.size = repairhis.size; repairStock.checktype = repairhis.checktype; repairStock.curpairqty = repairhis.pairqty; repairStock.ttlbadqty = 0; repairStock.ttlpairgoodqty = 0; repairStock.workgroup = repairhis.workgroup; repairStock.step = repairhis.step; repairStock.lastupdatetime = Function.GetCurrentTime(); baseDal.DoInsert(repairStock); } #region Update WIP wipDal.SaveOrUpdate(repairhis.customerid, repairhis.custorderno, repairhis.styleno, repairhis.color, repairhis.size, repairhis.step, repairhis.workgroup, Convert.ToInt16(-repairhis.pairqty), repairhis.checktype); wipDal.SaveOrUpdate(repairhis.customerid, repairhis.custorderno, repairhis.styleno, repairhis.color, repairhis.size, MES_WIPStatus.Repair.ToString(), repairhis.workgroup, Convert.ToInt16(repairhis.pairqty), repairhis.checktype); #endregion #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = ""; history.cartonno = ""; history.cartonqty = 0; history.custorderno = repairhis.custorderno; history.size = repairhis.size; history.styleno = repairhis.styleno; history.color = repairhis.color; history.eventgroup = Function.GetGUID(); history.eventname = "To Repair"; history.pairqty = repairhis.pairqty; history.refsysid = repairhis.repsysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
public void DoRepairBack(tinprepairstock repairstock, List<tinprepairfail> lstreasoncode, string jointtype, string signature) { try { dbInstance.BeginTransaction(); #region repairhis tinprepairhis goodhis = new tinprepairhis(); if (repairstock.ttlpairgoodqty > 0) { goodhis.repsysid = Function.GetGUID(); goodhis.workgroup = repairstock.workgroup; goodhis.step = repairstock.step; goodhis.reptype = MES_RepairType.RepairSuccess.ToString(); goodhis.customerid = repairstock.customerid; goodhis.custorderno = repairstock.custorderno; goodhis.styleno = repairstock.styleno; goodhis.color = repairstock.color; goodhis.size = repairstock.size; goodhis.checktype = repairstock.checktype; goodhis.pairqty = repairstock.ttlpairgoodqty; goodhis.claimtime = Function.GetCurrentTime(); goodhis.claimuser = CurrentContextInfo.CurrentUser; if (jointtype != null && signature != null) { goodhis.jointtype = jointtype; goodhis.signature = signature; } repairHisDal.DoInsert(goodhis); } tinprepairhis badhis = new tinprepairhis(); if (repairstock.ttlbadqty > 0) { badhis.repsysid = Function.GetGUID(); badhis.workgroup = repairstock.workgroup; badhis.step = repairstock.step; badhis.reptype = MES_RepairType.RepairFail.ToString(); badhis.customerid = repairstock.customerid; badhis.custorderno = repairstock.custorderno; badhis.styleno = repairstock.styleno; badhis.color = repairstock.color; badhis.size = repairstock.size; badhis.checktype = repairstock.checktype; badhis.pairqty = repairstock.ttlbadqty; badhis.claimtime = Function.GetCurrentTime(); badhis.claimuser = CurrentContextInfo.CurrentUser; repairHisDal.DoInsert(badhis); foreach (tinprepairfail repairfail in lstreasoncode) { repairfail.repsysid = badhis.repsysid; repairFailDal.DoInsert(repairfail); } } #endregion List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="customerid",ParamValue=repairstock.customerid}, new MESParameterInfo(){ParamName="custorderno",ParamValue=repairstock.custorderno}, new MESParameterInfo(){ParamName="styleno",ParamValue=repairstock.styleno}, new MESParameterInfo(){ParamName="color",ParamValue=repairstock.color}, new MESParameterInfo(){ParamName="size",ParamValue=repairstock.size}, new MESParameterInfo(){ParamName="checktype",ParamValue=repairstock.checktype}, new MESParameterInfo(){ParamName="step",ParamValue=repairstock.step}, new MESParameterInfo(){ParamName="workgroup",ParamValue=repairstock.workgroup} }; List<tinprepairstock> lstRepairStock = baseDal.GetSelectedObjects<tinprepairstock>(lstParams, string.Empty, true, -1); if (lstRepairStock.Count > 0) { tinprepairstock rsk = lstRepairStock[0]; rsk.curpairqty = rsk.curpairqty - repairstock.ttlpairgoodqty - repairstock.ttlbadqty; rsk.ttlbadqty = rsk.ttlbadqty + repairstock.ttlbadqty; rsk.ttlpairgoodqty = rsk.ttlpairgoodqty + repairstock.ttlpairgoodqty; rsk.lastupdatetime = Function.GetCurrentTime(); baseDal.DoUpdate(rsk); } #region Update WIP wipDal.SaveOrUpdate(repairstock.customerid, repairstock.custorderno, repairstock.styleno, repairstock.color, repairstock.size, repairstock.step, repairstock.workgroup, Convert.ToInt16(repairstock.ttlpairgoodqty), repairstock.checktype); wipDal.SaveOrUpdate(repairstock.customerid, repairstock.custorderno, repairstock.styleno, repairstock.color, repairstock.size, MES_WIPStatus.BAD.ToString(), MES_Misc.BadStock.ToString(), Convert.ToInt16(repairstock.ttlbadqty), repairstock.checktype); wipDal.SaveOrUpdate(repairstock.customerid, repairstock.custorderno, repairstock.styleno, repairstock.color, repairstock.size, MES_WIPStatus.Repair.ToString(), repairstock.workgroup, -Convert.ToInt16(repairstock.ttlpairgoodqty + repairstock.ttlbadqty), repairstock.checktype); #endregion #region Update CustomerOrder History string eventgroup = Function.GetGUID(); if (goodhis.pairqty > 0) { tinpcustorderhistory goodhistory = new tinpcustorderhistory(); goodhistory.customerid = goodhis.customerid; goodhistory.cartonno = ""; goodhistory.cartonqty = 0; goodhistory.custorderno = goodhis.custorderno; goodhistory.size = goodhis.size; goodhistory.styleno = goodhis.styleno; goodhistory.color = goodhis.color; goodhistory.eventgroup = eventgroup; goodhistory.eventname = "Repair"; goodhistory.pairqty = goodhis.pairqty; goodhistory.refsysid = goodhis.repsysid; goodhistory.remark = ""; goodhistory.eventtime = Function.GetCurrentTime(); goodhistory.eventuser = CurrentContextInfo.CurrentUser; goodhistory.ohsysid = Function.GetGUID(); goodhistory.shift = CurrentContextInfo.Shift; goodhistory.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(goodhistory); } if (badhis.pairqty > 0) { tinpcustorderhistory badhistory = new tinpcustorderhistory(); badhistory.customerid = badhis.customerid; badhistory.cartonno = ""; badhistory.cartonqty = 0; badhistory.custorderno = badhis.custorderno; badhistory.size = badhis.size; badhistory.styleno = badhis.styleno; badhistory.color = badhis.color; badhistory.eventgroup = eventgroup; badhistory.eventname = "Repair"; badhistory.pairqty = badhis.pairqty; badhistory.refsysid = badhis.repsysid; badhistory.remark = ""; badhistory.eventtime = Function.GetCurrentTime(); badhistory.eventuser = CurrentContextInfo.CurrentUser; badhistory.ohsysid = Function.GetGUID(); badhistory.shift = CurrentContextInfo.Shift; badhistory.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(badhistory); } #endregion dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
public void DoDeleteShipping(string shippingsysid) { try { dbInstance.BeginTransaction(); List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="shippingsysid",ParamValue=shippingsysid} }; List<tinpshippingdtlctn> lstctn = shippingDtlCtnDal.GetSelectedObjects<tinpshippingdtlctn>(lstParams); foreach (tinpshippingdtlctn shippingdtlctn in lstctn) { packingRecDtlDal.UpdateIsShipped(shippingdtlctn.customerid, shippingdtlctn.custorderno, shippingdtlctn.cartonno, Public_Flag.N.ToString()); } string shippingplanno = ""; List<tinpshippingdtl> lstdtl = shippingDtlDal.GetSelectedObjects<tinpshippingdtl>(lstParams); if (lstdtl.Count > 0) { shippingplanno = lstdtl[0].shippingplanno.ToString(); } List<MESParameterInfo> lstPlanParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="shippingplanno",ParamValue=shippingplanno} }; shippingPlanDal.DoDelete<tinpshippingplan>(lstPlanParams); shippingDtlCtnDal.DoDelete<tinpshippingdtlctn>(lstParams); shippingDtlDal.DoDelete<tinpshippingdtl>(lstParams); baseDal.DoDelete<tinpshipping>(lstParams); #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = ""; history.cartonno = ""; history.cartonqty = 0; history.custorderno = ""; history.size = ""; history.styleno = ""; history.color = ""; history.eventgroup = Function.GetGUID(); ; history.eventname = "Delete Shipping"; history.pairqty = 0; history.refsysid = shippingsysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
public void DoShipPlan(List<tinpshippingdtl> lstshippingdtl,tinpshippingplan shippingplan) { try { dbInstance.BeginTransaction(); List<MESParameterInfo> lstPlanParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="shippingplanno",ParamValue=shippingplan.shippingplanno} }; List<tinpshippingplan> lstShippingplan = shippingPlanDal.GetSelectedObjects<tinpshippingplan>(lstPlanParams); if (lstShippingplan.Count > 0) { shippingPlanDal.DoUpdate<tinpshippingplan>(shippingplan); } else { shippingPlanDal.DoInsert<tinpshippingplan>(shippingplan); } List<MESParameterInfo> lstDelParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="shippingsysid",ParamValue=lstshippingdtl[0].shippingsysid} }; shippingDtlDal.DoDelete<tinpshippingdtl>(lstDelParams); string eventgroup = Function.GetGUID(); foreach (tinpshippingdtl shippingdtl in lstshippingdtl) { shippingdtl.createduser = CurrentContextInfo.CurrentUser; shippingdtl.createdtime = Function.GetCurrentTime(); shippingdtl.lastmodifeduser = CurrentContextInfo.CurrentUser; shippingdtl.lastmodifiedtime = Function.GetCurrentTime(); shippingdtl.shippingstatus = MES_ShippingStatus.Plan.ToString(); shippingdtl.ttlpairqty = 0; shippingDtlDal.DoInsert<tinpshippingdtl>(shippingdtl); #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = shippingdtl.customerid; history.cartonno = ""; history.cartonqty = shippingdtl.ttlcantonqty; history.custorderno = shippingdtl.custorderno; history.size = ""; history.styleno = ""; history.color = ""; history.eventgroup = eventgroup; ; history.eventname = "ShipPlan"; history.pairqty = 0; history.refsysid = shippingdtl.shippingsysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion } dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }
public void DoShipping(tinpshipping shipping, List<tinpshippingdtlctn> lstshippingdtlctn, tinpshippingplan shippingplan, bool isDoShipping) { try { dbInstance.BeginTransaction(); List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="shippingsysid",ParamValue=shipping.shippingsysid} }; List<tinpshippingdtlctn> lstctn = shippingDtlCtnDal.GetSelectedObjects<tinpshippingdtlctn>(lstParams); foreach (tinpshippingdtlctn shippingdtlctn in lstctn) { packingRecDtlDal.UpdateIsShipped(shippingdtlctn.customerid,shippingdtlctn.custorderno, shippingdtlctn.cartonno, Public_Flag.N.ToString()); } shippingDtlCtnDal.DoDelete<tinpshippingdtlctn>(lstParams); shippingDtlDal.DoUpdateStatusByShippingSysId(shipping.shippingsysid, isDoShipping ? MES_ShippingStatus.Shipped.ToString() : MES_ShippingStatus.Created.ToString()); List<MESParameterInfo> lstPlanParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="shippingplanno",ParamValue=shippingplan.shippingplanno} }; List<tinpshippingplan> lstShippingplan = shippingPlanDal.GetSelectedObjects<tinpshippingplan>(lstPlanParams); if (lstShippingplan.Count > 0) { shippingPlanDal.DoUpdate<tinpshippingplan>(shippingplan); } else { shippingPlanDal.DoInsert<tinpshippingplan>(shippingplan); } List<tinpshipping> lstShipping = baseDal.GetSelectedObjects<tinpshipping>(lstParams); if (lstShipping.Count > 0) { tinpshipping shippingmdl = lstShipping[0]; shippingmdl.packingboxno = shipping.packingboxno; shippingmdl.blno = shipping.blno; shippingmdl.containerno = shipping.containerno; shippingmdl.loadingtype = shipping.loadingtype; //shippingmdl.contractno = shipping.contractno; shippingmdl.shippingstatus = isDoShipping ? MES_ShippingStatus.Shipped.ToString() : MES_ShippingStatus.Created.ToString(); shippingmdl.lastmodifeduser = CurrentContextInfo.CurrentUser; shippingmdl.lastmodifiedtime = Function.GetCurrentTime(); if (isDoShipping) { shippingmdl.shippeddate = Function.GetCurrentTime(); } baseDal.DoUpdate<tinpshipping>(shippingmdl); } else { shipping.shippingstatus = isDoShipping ? MES_ShippingStatus.Shipped.ToString() : MES_ShippingStatus.Created.ToString(); shipping.lastmodifeduser = CurrentContextInfo.CurrentUser; shipping.lastmodifiedtime = Function.GetCurrentTime(); shipping.createduser = CurrentContextInfo.CurrentUser; shipping.createdtime = Function.GetCurrentTime(); if (isDoShipping) { shipping.shippeddate = Function.GetCurrentTime(); } baseDal.DoInsert<tinpshipping>(shipping); } string eventgroup = Function.GetGUID(); List<tinpreceivingctndtl> lstReceivingRec = new List<tinpreceivingctndtl>(); foreach (tinpshippingdtlctn shippingdtlctn in lstshippingdtlctn) { shippingDtlCtnDal.DoInsert<tinpshippingdtlctn>(shippingdtlctn); packingRecDtlDal.UpdateIsShipped(shippingdtlctn.customerid,shippingdtlctn.custorderno, shippingdtlctn.cartonno,Public_Flag.Y.ToString()); if (isDoShipping) { List<MESParameterInfo> lstRecParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="customerid",ParamValue=shippingdtlctn.customerid}, new MESParameterInfo(){ParamName="custorderno",ParamValue=shippingdtlctn.custorderno}, new MESParameterInfo(){ParamName="cartonno",ParamValue=shippingdtlctn.cartonno} }; List<tinpreceivingctndtl> lstRec = receivingCtnDtlDal.GetSelectedObjects<tinpreceivingctndtl>(lstRecParams); foreach (tinpreceivingctndtl rec in lstRec) { rec.cartonstatus = MES_CartonStatus.Finished.ToString(); rec.cartonlocation = MES_CartonLocation.Shipped.ToString(); lstReceivingRec.Add(rec); //receivingCtnDtlDal.DoUpdate(rec); } } #region Update CustomerOrder History tinpcustorderhistory history = new tinpcustorderhistory(); history.customerid = shippingdtlctn.customerid; history.cartonno = shippingdtlctn.cartonno; history.cartonqty = 0; history.custorderno = shippingdtlctn.custorderno; history.size = ""; history.styleno = ""; history.color = ""; history.eventgroup = eventgroup; ; history.eventname = "Shipping"; history.pairqty = 0; history.refsysid = shipping.shippingsysid; history.remark = ""; history.eventtime = Function.GetCurrentTime(); history.eventuser = CurrentContextInfo.CurrentUser; history.ohsysid = Function.GetGUID(); history.shift = CurrentContextInfo.Shift; history.workgroup = CurrentContextInfo.WorkGroup; custOrderHistoryDal.DoInsert<tinpcustorderhistory>(history); #endregion } foreach (tinpreceivingctndtl rec in lstReceivingRec) { receivingCtnDtlDal.DoUpdate(rec); } dbInstance.Commit(); } catch (Exception ex) { dbInstance.Rollback(); throw ex; } finally { dbInstance.CloseConnection(); } }