/// <summary> /// Create a new tinpshippingplan object. /// </summary> /// <param name="shippingplanno">Initial value of the shippingplanno property.</param> public static tinpshippingplan Createtinpshippingplan(global::System.String shippingplanno) { tinpshippingplan tinpshippingplan = new tinpshippingplan(); tinpshippingplan.shippingplanno = shippingplanno; return tinpshippingplan; }
private void DoShipPlan() { wsINP.IwsINPClient client = new wsINP.IwsINPClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); if (ShipingSysId == null) { ShipingSysId = Function.GetGUID(); } List<string> lstcustorderno = new List<string>(); List<tinpshippingdtl> lstshippingdtl = new List<tinpshippingdtl>(); foreach (UltraGridRow row in this.grdDetail.Rows) { if (lstcustorderno.Contains(row.Cells["custorderno"].Value.ToString())) { throw new Exception(UtilCulture.GetString("Msg.R01022", row.Cells["custorderno"].Value.ToString())); } else { lstcustorderno.Add(row.Cells["custorderno"].Value.ToString()); } if ( Convert.ToInt16(row.Cells["cartonqty"].Value) <= 0) { throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R02021"))); } int maxcartonqty = getMaxCartonQty(((ValueInfo)this.cmbCustomer.SelectedItem).ValueField,row.Cells["custorderno"].Value.ToString()); if (Convert.ToInt16(row.Cells["cartonqty"].Value) >maxcartonqty ) { throw new Exception(UtilCulture.GetString("Msg.R01014", UtilCulture.GetString("Label.R02021"), maxcartonqty.ToString())); } tinpshippingdtl dtl = new tinpshippingdtl(); if (UpdateMode == Public_UpdateMode.Update) { List<MESParameterInfo> lstParams = new List<MESParameterInfo>() { new MESParameterInfo(){ParamName="custorderno",ParamValue=row.Cells["custorderno"].Value.ToString()}, new MESParameterInfo(){ParamName="shippingsysid",ParamValue=ShipingSysId} }; DataSet ds = client.GetShippingDtlCtnRecords(baseForm.CurrentContextInfo, lstParams.ToArray<MESParameterInfo>()); if (ds.Tables[0].Rows.Count > Convert.ToInt16(row.Cells["cartonqty"].Value)) { throw new Exception(UtilCulture.GetString("Msg.R01023", UtilCulture.GetString("Label.R02021"), ds.Tables[0].Rows.Count.ToString())); } } dtl.shippingsysid = ShipingSysId; dtl.shippingplanno = this.txtShippingPlanNo.Text; dtl.customerid =((ValueInfo)this.cmbCustomer.SelectedItem).ValueField; dtl.custorderno = row.Cells["custorderno"].Value.ToString(); dtl.ttlcantonqty = Convert.ToInt16(row.Cells["cartonqty"].Value); lstshippingdtl.Add(dtl); } if (lstshippingdtl.Count == 0) { throw new Exception(UtilCulture.GetString("Msg.R01019")); } tinpshippingplan shippingplan = new tinpshippingplan(); shippingplan.shippingplanno = this.txtShippingPlanNo.Text; shippingplan.loadingdate = Convert.ToDateTime(this.dtLoadingDt.Value); shippingplan.boxqty = this.txtBoxQty.Text; shippingplan.deliverybill = this.txtDeliveryBill.Text; shippingplan.inshipno = this.txtInShipNo.Text; shippingplan.commissionedqty =Convert.ToInt16( this.numCommissionedQty.Value); shippingplan.commissionedvolume = this.numCommissionedVolume.Value; shippingplan.commissionedweight = this.numCommissionedWeight.Value; shippingplan.startport = this.txtStartPort.Text; shippingplan.destinationport = this.txtDestinationPort.Text; shippingplan.unloadport = this.txtUnloadPort.Text; shippingplan.voyage = this.txtVoyage.Text; shippingplan.remark = this.txtRemark.Text; client.DoShipPlan(baseForm.CurrentContextInfo, lstshippingdtl.ToArray<tinpshippingdtl>(), shippingplan); if (UpdateMode == Public_UpdateMode.Update) { baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00002")); } else { baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00001")); } this.Close(); } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }
/// <summary> /// Deprecated Method for adding a new object to the tinpshippingplan EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotinpshippingplan(tinpshippingplan tinpshippingplan) { base.AddObject("tinpshippingplan", tinpshippingplan); }
private void DoShipping(bool isDoShipping) { wsINP.IwsINPClient client = new wsINP.IwsINPClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); List<tinpshippingdtlctn> lstshippingdtlctn = new List<tinpshippingdtlctn>(); foreach (string key in ht.Keys) { DataTable dt = ht[key] as DataTable; int ctnqty = 0; foreach (DataRow row in dt.Rows) { if (row["ck"].ToString().Equals("Y")) { tinpshippingdtlctn shippingdtlctn = new tinpshippingdtlctn(); shippingdtlctn.shippingsysid = ShipingSysId; shippingdtlctn.customerid = row["customerid"].ToString(); shippingdtlctn.custorderno = key; shippingdtlctn.cartonno = row["cartonno"].ToString(); shippingdtlctn.pairqty = Convert.ToInt16(row["pairqty"].ToString()); lstshippingdtlctn.Add(shippingdtlctn); ctnqty++; } } if (ctnqty > getPlanQty(key) || (isDoShipping && ctnqty != getPlanQty(key))) { throw new Exception(UtilCulture.GetString("Msg.R01024")); } } tinpshipping shipping = new tinpshipping(); shipping.shippingsysid = ShipingSysId; shipping.packingboxno = this.txtPackingBoxNo.Text; shipping.shippingno = this.txtShipNo.Text; shipping.containerno = this.txtContainerNo.Text; shipping.blno = this.txtBlNo.Text; //shipping.contractno = this.txtContractNo.Text; if (this.cmbLoadingType.SelectedItem != null) { shipping.loadingtype = ((ValueInfo)this.cmbLoadingType.SelectedItem).ValueField; } tinpshippingplan shippingplan = new tinpshippingplan(); shippingplan.shippingplanno = ((ValueInfo)this.cmbShippingPlanNo.SelectedItem).DisplayField; shippingplan.loadingdate = Convert.ToDateTime(this.dtLoadingDt.Value); shippingplan.boxqty = this.txtBoxQty.Text; shippingplan.deliverybill = this.txtBlNo.Text; shippingplan.inshipno = this.txtInShipNo.Text; shippingplan.commissionedqty = Convert.ToInt16(this.numCommissionedQty.Value); shippingplan.commissionedvolume = this.numCommissionedVolume.Value; shippingplan.commissionedweight = this.numCommissionedWeight.Value; shippingplan.startport = this.txtStartPort.Text; shippingplan.destinationport = this.txtDestinationPort.Text; shippingplan.unloadport = this.txtUnloadPort.Text; shippingplan.voyage = this.txtVoyage.Text; client.DoShipping(baseForm.CurrentContextInfo, shipping, lstshippingdtlctn.ToArray<tinpshippingdtlctn>(),shippingplan, isDoShipping); baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00028")); this.Close(); } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }
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(); } }
public void DoShipPlan(ContextInfo contextInfo, List<tinpshippingdtl> lstshippingdtl, tinpshippingplan shippingplan) { contextInfo.Action = MES_ActionType.Insert; ShippingBll bll = new ShippingBll(contextInfo); bll.CallAccessControl(); bll.DoShipPlan(lstshippingdtl, shippingplan); GC.Collect(); }
public void DoShipping(ContextInfo contextInfo, tinpshipping shipping, List<tinpshippingdtlctn> lstshippingdtlctn, tinpshippingplan shippingplan, bool isDoShipping) { contextInfo.Action = MES_ActionType.Insert; ShippingBll bll = new ShippingBll(contextInfo); bll.CallAccessControl(); bll.DoShipping(shipping, lstshippingdtlctn,shippingplan, isDoShipping); GC.Collect(); }