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 tinpreturn object. /// </summary> /// <param name="retsysid">Initial value of the retsysid property.</param> public static tinpreturn Createtinpreturn(global::System.String retsysid) { tinpreturn tinpreturn = new tinpreturn(); tinpreturn.retsysid = retsysid; return tinpreturn; }
/// <summary> /// Deprecated Method for adding a new object to the tinpreturn EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotinpreturn(tinpreturn tinpreturn) { base.AddObject("tinpreturn", tinpreturn); }
private void DoReturn() { wsINP.IwsINPClient client = new wsINP.IwsINPClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); if (UpdateMode == Public_UpdateMode.Insert) { inpreturn = new tinpreturn(); inpreturn.returnno = this.txtReturnNo.Text; inpreturn.customerid = ((ValueInfo)this.cmbCustomer.SelectedItem).ValueField; inpreturn.retsysid = Function.GetGUID(); inpreturn.returndate = Function.GetCurrentTime(); inpreturn.returnuser = Function.GetCurrentUser(); } inpreturn.returntype = ((ValueInfo)this.cmbReturnType.SelectedItem).ValueField; inpreturn.lastmodifiedtime = Function.GetCurrentTime(); inpreturn.lastmodifieduser = Function.GetCurrentUser(); List<tinpreturndtl> lstreturndtl = new List<tinpreturndtl>(); foreach (UltraGridRow row in this.grdDetail.Rows) { if (row.Cells["ck"].Value.ToString().Equals("Y")) { if (Convert.ToInt16(row.Cells["returnqty"].Value) == 0 && UpdateMode == Public_UpdateMode.Insert) { throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R02043"))); } if (Convert.ToInt16(row.Cells["pairqty"].Value) < Convert.ToInt16(row.Cells["returnqty"].Value)) { throw new Exception(UtilCulture.GetString("Msg.R01014", UtilCulture.GetString("Label.R02043"), UtilCulture.GetString("Label.R02026"))); } tinpreturndtl returndtl = new tinpreturndtl(); returndtl.retdtlsysid = Function.GetGUID(); returndtl.retsysid = inpreturn.retsysid; returndtl.customerid = inpreturn.customerid; returndtl.custorderno = row.Cells["custorderno"].Value.ToString(); returndtl.styleno = row.Cells["styleno"].Value.ToString(); returndtl.color = row.Cells["color"].Value.ToString(); returndtl.size = row.Cells["size"].Value.ToString(); returndtl.checktype = row.Cells["checktype"].Value.ToString(); returndtl.pairqty = Convert.ToInt16(row.Cells["returnqty"].Value); lstreturndtl.Add(returndtl); } } if (lstreturndtl.Count == 0 && UpdateMode == Public_UpdateMode.Insert) { throw new Exception(UtilCulture.GetString("Msg.R01018")); } client.DoReturn(baseForm.CurrentContextInfo,inpreturn,lstreturndtl.ToArray<tinpreturndtl>()); baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00002")); this.Close(); } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }
private void frmReturn_Load(object sender, EventArgs e) { baseForm.SetFace(this); baseForm.SetQueryGridStyle(this.grdDetail); try { DataTable custDt = GetAllCustomer().Tables[0]; DropDown.InitCMB_DataTable(this.cmbCustomer, custDt, "customername", "customerid"); DropDown.InitCMB_StaticValue(this.cmbReturnType, MES_StaticValue_Type.ReturnType); if (retSysId != null) { UpdateMode = Public_UpdateMode.Update; } else { UpdateMode = Public_UpdateMode.Insert; } if (UpdateMode == Public_UpdateMode.Insert) { BillLockRefId = Function.GetGUID(); ReceivingNoNamingRule = baseForm.GetSystemConfig("SYS_RETURNNO"); List<string> lstRecNo = baseForm.GetBillNoBatch(ReceivingNoNamingRule, 1, BillLockRefId); this.txtReturnNo.Text = lstRecNo[0]; this.txtReturnNo.Enabled = false; IsNeedToUnlockBill = true; } else { inpreturn = GetSingleReturn(retSysId); returndtlDt = GetReturnDtl(retSysId).Tables[0]; this.txtReturnNo.Text = inpreturn.returnno; DropDown.SelectCMBValue(this.cmbCustomer,inpreturn.customerid); DropDown.SelectCMBValue(this.cmbReturnType, inpreturn.returntype); this.txtReturnNo.Enabled = false; this.cmbCustomer.Enabled = false; } } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } }
public void DoReturn(ContextInfo contextInfo, tinpreturn inpreturn, List<tinpreturndtl> lstreturndtl) { contextInfo.Action = MES_ActionType.Insert; ReturnBll bll = new ReturnBll(contextInfo); bll.CallAccessControl(); bll.DoReturn(inpreturn,lstreturndtl); GC.Collect(); }