예제 #1
0
        //装箱保存
        public bool MoveBoxSave(DataTable dt, string trayID, string user, string workGroup, string oldWorkGroup)
        {
            String recid = GENLSYS.MES.Common.Function.GetGUID();
            String pktype = MES_PackingType.Moving.ToString();
            DateTime actiondate = System.DateTime.Now;
            String factory = "";
            String userid = user;
            decimal? ttlqty = 0;
            string custorderno = "";
            String cartonno = "";
            String customerid = "";
            int dtl = dt.Rows.Count;
            dbInstance.BeginTransaction();
            try
            {
                for (int i = 0; i < dtl; i++)
                {
                    tinppackingrecdtl obj = new tinppackingrecdtl();
                    cartonno = dt.Rows[i]["cartonNumber"].ToString();
                    customerid = dt.Rows[i]["customerid"].ToString();
                    custorderno = dt.Rows[i]["poid"].ToString();

                    obj.custorderno = custorderno;
                    obj.cartonno = dt.Rows[i]["cartonNumber"].ToString();
                    customerid = dt.Rows[i]["customerid"].ToString();
                    obj.color = dt.Rows[i]["color"].ToString();
                    decimal? qty = decimal.Parse((dt.Rows[i]["qty2"].ToString()));
                    obj.pairqty = qty;
                    obj.pksysid = recid;
                    obj.size = dt.Rows[i]["size"].ToString();
                    obj.styleno = dt.Rows[i]["type"].ToString();
                    obj.pksysid = recid;
                    obj.confirmqty = qty;
                    obj.difference = 0;
                    obj.isshipped = "N";
                    obj.remark = "装箱";
                    obj.pktype = pktype;
                    obj.customerid = dt.Rows[i]["customerid"].ToString();

                    ttlqty = ttlqty + qty;
                    localDal.DoInsert<tinppackingrecdtl>(obj);
                    //get checktype from receiving

                    List<MESParameterInfo> lstParam = new List<MESParameterInfo>() {
                              new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                                 new MESParameterInfo(){ParamName="cartonno",ParamValue=obj.cartonno},
                                 new MESParameterInfo(){ParamName="customerid",ParamValue=obj.customerid}
                      };

                    List<tinpreceivingctndtl> ctlDtl = baseDal.GetSelectedObjects<tinpreceivingctndtl>(lstParam);
                    string checktype = ctlDtl[0].checktype;
                    WipDal wip = new WipDal(dbInstance);
                    wip.SaveOrUpdate(obj.customerid, obj.custorderno, obj.styleno, obj.color, obj.size, "I", oldWorkGroup, -1 * (int)qty, checktype);
                    wip.SaveOrUpdate(obj.customerid, obj.custorderno, obj.styleno, obj.color, obj.size, "X", workGroup, (int)qty, checktype);  //workGroup是固定值Line0,从UI传过来

                    //  Repositories.Inspection.INP.PackingRecRetrieveDal recRetrieveDal = new Repositories.Inspection.INP.PackingRecRetrieveDal(this.dbInstance);
                    //   recRetrieveDal.InsertRetrieve(recid, obj.cartonno, obj.custorderno, obj.styleno, obj.color, obj.size);
                }

                tinppackingrec headObj = new tinppackingrec();
                headObj.custorderno = custorderno;
                headObj.pksysid = recid;
                headObj.pktype = pktype;
                headObj.ttlqty = ttlqty;
                headObj.userid = user;
                headObj.workgroup = workGroup;
                headObj.actiondate = System.DateTime.Now;
                headObj.remark = trayID;
                headObj.customerid = customerid;
                localDal.DoInsert<tinppackingrec>(headObj);
                dbInstance.Commit();
                return true;
            }
            catch (Exception e)
            {
                dbInstance.Rollback();
                return false;
            }
        }
예제 #2
0
        ////201306 George --Begin
        //空箱装箱保存
        public bool MoveBoxSaveDummy(string _customerid, string _poid, string _cartonNumber, string user, string workGroup)
        {
            String recid = GENLSYS.MES.Common.Function.GetGUID();
            String pktype = MES_PackingType.Moving.ToString();
            DateTime actiondate = System.DateTime.Now;
            String factory = "";
            String userid = user;
            decimal? ttlqty = 0;
            string custorderno = "";
            String cartonno = "";
            String customerid = "";

            dbInstance.BeginTransaction();
            try
            {
                tinppackingrecdtl obj = new tinppackingrecdtl();

                customerid = _customerid;
                custorderno = _poid;
                cartonno = _cartonNumber;

                obj.custorderno = custorderno;
                obj.cartonno = cartonno;
                obj.color = "$";
                obj.pairqty = 0;
                obj.pksysid = recid;
                obj.size = "$";
                obj.styleno = "$";
                obj.pksysid = recid;
                obj.confirmqty = 0;
                obj.difference = 0;
                obj.isshipped = "N";
                obj.remark = "装箱";
                obj.pktype = pktype;
                obj.customerid = customerid;
                localDal.DoInsert<tinppackingrecdtl>(obj);
                //WIP no change
                //  Repositories.Inspection.INP.PackingRecRetrieveDal recRetrieveDal = new Repositories.Inspection.INP.PackingRecRetrieveDal(this.dbInstance);
                //   recRetrieveDal.InsertRetrieve(recid, obj.cartonno, obj.custorderno, obj.styleno, obj.color, obj.size);

                tinppackingrec headObj = new tinppackingrec();
                headObj.custorderno = custorderno;
                headObj.pksysid = recid;
                headObj.pktype = pktype;
                headObj.ttlqty = ttlqty;
                headObj.userid = user;
                headObj.workgroup = workGroup;
                headObj.actiondate = System.DateTime.Now;
                headObj.remark = "Dummy";
                headObj.customerid = customerid;
                localDal.DoInsert<tinppackingrec>(headObj);
                dbInstance.Commit();
                return true;
            }
            catch (Exception e)
            {
                dbInstance.Rollback();
                return false;
            }
        }
예제 #3
0
        ////201306 George --begin
        //空箱封箱保存
        public bool AssyBoxSaveDummy(string _customerid, string _poid, string _cartonNumber, string user, string workGroup)
        {
            String recid = GENLSYS.MES.Common.Function.GetGUID();
            String pktype = MES_PackingType.Packing.ToString();
            DateTime actiondate = System.DateTime.Now;
            String factory = "";
            String userid = user;
            decimal? ttlqty = 0;
            string custorderno = "";
            String cartonno = "";
            String customerid = "";

            dbInstance.BeginTransaction();
            try
            {
                customerid = _customerid;
                custorderno = _poid;
                cartonno = _cartonNumber;
                //delete line warehouse if exists
                List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                          new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                          new MESParameterInfo(){ParamName="cartonNumber",ParamValue= cartonno},
                          new MESParameterInfo(){ParamName="customerid",ParamValue= customerid}
                     };
                baseDal.DoDelete<tinplinewarehouse>(lstParam2);

                //insert
                tinppackingrecdtl obj = new tinppackingrecdtl();
                obj.custorderno = custorderno;
                obj.cartonno = cartonno;
                obj.color = "$";
                obj.pairqty = 0;
                obj.pksysid = recid;
                obj.size = "$";
                obj.styleno = "$";

                obj.confirmqty = 0;
                obj.difference = 0;
                obj.isshipped = "N";
                obj.remark = "封箱";
                obj.pktype = pktype;
                obj.customerid = customerid;
                localDal.DoInsert<tinppackingrecdtl>(obj);

                //wip  no change

                //  Repositories.Inspection.INP.PackingRecRetrieveDal recRetrieveDal = new Repositories.Inspection.INP.PackingRecRetrieveDal(this.dbInstance);
                //  recRetrieveDal.InsertRetrieve(recid, obj.cartonno, obj.custorderno, obj.styleno, obj.color, obj.size);

                tinppackingrec headObj = new tinppackingrec();
                headObj.custorderno = custorderno;
                headObj.pksysid = recid;
                headObj.pktype = pktype;
                headObj.ttlqty = ttlqty;
                headObj.userid = user;
                headObj.workgroup = workGroup;
                headObj.customerid = customerid;
                headObj.remark = "Dummy";
                headObj.actiondate = System.DateTime.Now;
                localDal.DoInsert<tinppackingrec>(headObj);
                dbInstance.Commit();
                return true;
            }
            catch (Exception e)
            {
                dbInstance.Rollback();
                return false;
            }
        }
예제 #4
0
 /// <summary>
 /// Create a new tinppackingrec object.
 /// </summary>
 /// <param name="pksysid">Initial value of the pksysid property.</param>
 public static tinppackingrec Createtinppackingrec(global::System.String pksysid)
 {
     tinppackingrec tinppackingrec = new tinppackingrec();
     tinppackingrec.pksysid = pksysid;
     return tinppackingrec;
 }
예제 #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tinppackingrec EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotinppackingrec(tinppackingrec tinppackingrec)
 {
     base.AddObject("tinppackingrec", tinppackingrec);
 }
예제 #6
0
        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();
            }
        }
예제 #7
0
        //save carton
        public bool openBoxSave(DataTable dt, string trayID, string user, string workGroup)
        {
            try
            {
                dbInstance.BeginTransaction();
                OpenBoxDal dal = new OpenBoxDal(dbInstance);
                //
                String recid = GENLSYS.MES.Common.Function.GetGUID();
                String pktype = MES_PackingType.Unpacking.ToString();
                DateTime actiondate = System.DateTime.Now;
                String factory = "";
                String userid = user;
                String cartonno = "";
                String customerid = "";

                decimal? ttlqty = 0;
                string custorderno = "";
                int dtl = dt.Rows.Count;
                for (int i = 0; i < dtl; i++)
                {
                    tinppackingrecdtl obj = new tinppackingrecdtl();
                    cartonno = dt.Rows[i]["cartonNumber"].ToString();
                    customerid = dt.Rows[i]["customerid"].ToString();
                    custorderno = dt.Rows[i]["poid"].ToString();

                    obj.custorderno = custorderno;
                    obj.cartonno = dt.Rows[i]["cartonNumber"].ToString();
                    obj.color = dt.Rows[i]["color"].ToString();
                    decimal? qty = decimal.Parse((dt.Rows[i]["qty"].ToString()));
                    obj.pairqty = qty;
                    obj.pksysid = recid;
                    obj.size = dt.Rows[i]["size"].ToString();
                    obj.styleno = dt.Rows[i]["type"].ToString();

                    obj.confirmqty = 0;
                    obj.difference = 0;
                    obj.isshipped = "N";
                    obj.remark = "开箱";
                    obj.pktype = pktype;
                    obj.customerid = dt.Rows[i]["customerid"].ToString();
                    ttlqty = ttlqty + qty;
                    //insert opening box detail
                    localDal.DoInsert<tinppackingrecdtl>(obj);
                    //get checktype from receiving
                    List<MESParameterInfo> lstParam = new List<MESParameterInfo>()
                       {
                           new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                           new MESParameterInfo(){ParamName="cartonno",ParamValue=obj.cartonno} ,
                            new MESParameterInfo(){ParamName="customerid",ParamValue=obj.customerid}

                       };

                    List<tinpreceivingctndtl> ctlDtl = baseDal.GetSelectedObjects<tinpreceivingctndtl>(lstParam);
                    string checktype = ctlDtl[0].checktype;
                    string wipstatus = "I";
                    ////201306 George --Begin
                    if (checktype == "X")
                    {
                        wipstatus = "X";
                    }
                    ////201306 George --End
                    //insert wip
                    WipDal wip = new WipDal(dbInstance);
                    wip.SaveOrUpdate(obj.customerid, obj.custorderno, obj.styleno, obj.color, obj.size, wipstatus, workGroup, (int)qty, checktype);
                    //update carton.location of receiving
                    localDal.UpdateCartonLocation(obj.customerid, custorderno, obj.cartonno, user, MES_CartonLocation.WIP.ToString());
                }
                //insert opening box summary table
                tinppackingrec headObj = new tinppackingrec();
                headObj.custorderno = custorderno;
                headObj.pksysid = recid;
                headObj.pktype = pktype;
                headObj.ttlqty = ttlqty;
                headObj.userid = user;
                headObj.workgroup = workGroup;
                headObj.actiondate = System.DateTime.Now;
                headObj.customerid = customerid;
                headObj.remark = trayID;
                localDal.DoInsert<tinppackingrec>(headObj);
                //delete line warehouse, if exists
                List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                          new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                          new MESParameterInfo(){ParamName="cartonNumber",ParamValue= cartonno},
                          new MESParameterInfo(){ParamName="customerid",ParamValue= customerid}
                };
                baseDal.DoDelete<tinplinewarehouse>(lstParam2);

                dbInstance.Commit();
                return true;
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }