示例#1
0
 /// <summary>
 /// Create a new tinprepairhis object.
 /// </summary>
 /// <param name="repsysid">Initial value of the repsysid property.</param>
 /// <param name="custorderno">Initial value of the custorderno property.</param>
 /// <param name="styleno">Initial value of the styleno property.</param>
 /// <param name="color">Initial value of the color property.</param>
 /// <param name="size">Initial value of the size property.</param>
 public static tinprepairhis Createtinprepairhis(global::System.String repsysid, global::System.String custorderno, global::System.String styleno, global::System.String color, global::System.String size)
 {
     tinprepairhis tinprepairhis = new tinprepairhis();
     tinprepairhis.repsysid = repsysid;
     tinprepairhis.custorderno = custorderno;
     tinprepairhis.styleno = styleno;
     tinprepairhis.color = color;
     tinprepairhis.size = size;
     return tinprepairhis;
 }
示例#2
0
        private void DoRepair(bool closeFlag)
        {
            wsINP.IwsINPClient client = new wsINP.IwsINPClient();
            try{
                baseForm.SetCursor();
                baseForm.ValidateData(this);
                if (this.numRepairQty.Value > Convert.ToInt16(this.txtPairQty.Text))
                {
                    throw new Exception(UtilCulture.GetString("Msg.R01014", UtilCulture.GetString("Label.R02026"), UtilCulture.GetString("Label.R02036")));
                }

                tinprepairhis his = new tinprepairhis();
                his.repsysid = Function.GetGUID();
                his.workgroup = ((ValueInfo)this.cmbWorkGroup.SelectedItem).ValueField;
                his.step = ((ValueInfo)this.cmbStep.SelectedItem).ValueField;
                his.reptype = MES_RepairType.ToRepair.ToString();
                his.customerid = this.ucmbCustOrderNo.SelectedRow.Cells["customerid"].Value.ToString();
                his.custorderno = this.ucmbCustOrderNo.Value.ToString();
                his.styleno = this.txtStyleNo.Text;
                his.color = this.txtColor.Text;
                his.size = this.txtSize.Text;
                his.checktype = this.ucmbCustOrderNo.SelectedRow.Cells["checktype"].Value.ToString();
                his.isfirst = this.ckIsFirst.Checked ? MES_Misc.Y.ToString() : MES_Misc.N.ToString();
                his.pairqty = this.numRepairQty.Value;
                his.claimtime = Function.GetCurrentTime();
                his.claimuser = Function.GetCurrentUser();

                List<tinprepairfail> lstreasoncode = new List<tinprepairfail>();

                foreach (UltraGridRow row in this.grdDetail.Rows)
                {
                    if (row.Cells["ck"].Value.ToString().Equals("Y"))
                    {
                        if (Convert.ToDecimal(row.Cells["pairqty"].Value)==0)
                        {
                            throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R02036")));
                        }
                        tinprepairfail repairfail = new tinprepairfail();
                        repairfail.reasoncode = row.Cells["reasoncode"].Value.ToString();
                        repairfail.remark = row.Cells["remark"].Value.ToString();
                        repairfail.pairqty = Convert.ToDecimal(row.Cells["pairqty"].Value);
                        lstreasoncode.Add(repairfail);
                    }
                }

                if (this.numRepairQty.Value == 0)
                {
                    throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R02036")));
                }
                if (lstreasoncode.Count == 0)
                {
                    throw new Exception(UtilCulture.GetString("Msg.R01015"));
                }

                client.DoInsertRepair(baseForm.CurrentContextInfo, his, lstreasoncode.ToArray<tinprepairfail>());
                baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00002"));
                if (closeFlag)
                {
                    this.Close();
                }
                else
                {
                    Clean();
                }

            }
            catch (Exception ex)
            {
                baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message);
            }
            finally
            {
                baseForm.ResetCursor();
                baseForm.CloseWCF(client);
            }
        }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tinprepairhis EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotinprepairhis(tinprepairhis tinprepairhis)
 {
     base.AddObject("tinprepairhis", tinprepairhis);
 }
示例#4
0
 private void ucToolbar1_AdjustEventHandler(object sender, EventArgs e)
 {
     frmRepairAdjust f = new frmRepairAdjust();
     tinprepairhis repairhis = new tinprepairhis();
     repairhis.repsysid = this.grdQuery.ActiveRow.Cells["repsysid"].Value.ToString();
     repairhis.customerid = this.grdQuery.ActiveRow.Cells["customerid"].Value.ToString();
     repairhis.custorderno = this.grdQuery.ActiveRow.Cells["custorderno"].Value.ToString();
     repairhis.styleno = this.grdQuery.ActiveRow.Cells["styleno"].Value.ToString();
     repairhis.size = this.grdQuery.ActiveRow.Cells["size"].Value.ToString();
     repairhis.color = this.grdQuery.ActiveRow.Cells["color"].Value.ToString();
     repairhis.pairqty = Convert.ToInt16(this.grdQuery.ActiveRow.Cells["pairqty"].Value.ToString());
     repairhis.step = this.grdQuery.ActiveRow.Cells["step"].Value.ToString();
     repairhis.workgroup = this.grdQuery.ActiveRow.Cells["workgroup"].Value.ToString();
     repairhis.reptype = this.grdQuery.ActiveRow.Cells["reptype"].Value.ToString();
     f.Customer = this.grdQuery.ActiveRow.Cells["customername"].Value.ToString();
     f.ReaseanCode = this.grdQuery.ActiveRow.Cells["reasoncode"].Value.ToString();
     f.RepairHis = repairhis;
     f.ShowDialog();
     RefreshGrid();
 }
示例#5
0
        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();
            }
        }
示例#6
0
        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();
            }
        }
示例#7
0
 public void DoInsertRepair(ContextInfo contextInfo, tinprepairhis repairhis, List<tinprepairfail> lstreasoncode)
 {
     contextInfo.Action = MES_ActionType.Insert;
     RepairStockBll bll = new RepairStockBll(contextInfo);
     bll.CallAccessControl();
     bll.DoInsertRepair(repairhis, lstreasoncode);
     GC.Collect();
 }