Esempio n. 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;
            }
        }
Esempio n. 2
0
        //取消封箱
        public bool CancelPack(string customer, string cartonno, string poid, string user)
        {
            try
            {
                dbInstance.BeginTransaction();
                OpenBoxDal dal = new OpenBoxDal(dbInstance);
                //get checktype from receiving
                List<MESParameterInfo> param = new List<MESParameterInfo>() {
                         new MESParameterInfo(){ParamName="custorderno",ParamValue=poid },
                         new MESParameterInfo(){ParamName="cartonno",ParamValue= cartonno} ,
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };

                List<tinpreceivingctndtl> rs = baseDal.GetSelectedObjects<tinpreceivingctndtl>(param);
                string checktype = rs[0].checktype;

                //get detail record of Opening  box  --tinppackingrecdtl
                List<MESParameterInfo> lstParam0 = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="custorderno",ParamValue=poid},
                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                         new MESParameterInfo(){ParamName="pktype",ParamValue=MES_PackingType.Unpacking.ToString()},
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };
                List<tinppackingrecdtl> ctlDtl0 = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam0);
                string sysid = ctlDtl0[0].pksysid;

                List<MESParameterInfo> lstParam1 = new List<MESParameterInfo>() {
                         new MESParameterInfo(){ParamName="pksysid",ParamValue=sysid}
                    };
                List<tinppackingrec> ctlDtl1 = baseDal.GetSelectedObjects<tinppackingrec>(lstParam1);
                string oldWorkGroup = ctlDtl1[0].workgroup;

                //get detail record of packing  box  --tinppackingrecdtl
                List<MESParameterInfo> lstParam = new List<MESParameterInfo>() {
                         new MESParameterInfo(){ParamName="custorderno",ParamValue=poid},
                         new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                         new MESParameterInfo(){ParamName="pktype",ParamValue=MES_PackingType.Packing.ToString()},
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };
                List<tinppackingrecdtl> ctlDtl = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam);
                //sum qty

                for (int i = 0; i < ctlDtl.Count; i++)
                {
                    //process wip-------把X线上Line0的WIP扣除--------
                    WipDal wip = new WipDal(dbInstance);

                    if (checktype == "IX")
                    {
                        wip.SaveOrUpdate(customer, ctlDtl[i].custorderno, ctlDtl[i].styleno, ctlDtl[i].color, ctlDtl[i].size, "X", "Line0", (int)ctlDtl[i].pairqty, checktype);
                    }
                    else
                    {
                        wip.SaveOrUpdate(customer, ctlDtl[i].custorderno, ctlDtl[i].styleno, ctlDtl[i].color, ctlDtl[i].size, "I", oldWorkGroup, (int)ctlDtl[i].pairqty, checktype);
                    }

                }
                //delete Moving detail
                baseDal.DoDelete<tinppackingrecdtl>(lstParam);
                //delete moving header
                if (ctlDtl.Count > 0)
                {
                    string sysid2 = ctlDtl[0].pksysid;
                    List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="pksysid",ParamValue=sysid2}  };
                    baseDal.DoDelete<tinppackingrec>(lstParam2);
                }

                ////////////////delete   tinppackingrecretrieve//////////////////2012-6-30//////
                List<MESParameterInfo> param5 = new List<MESParameterInfo>() {
                         new MESParameterInfo(){ParamName="custorderno",ParamValue=poid },
                         new MESParameterInfo(){ParamName="cartonno",ParamValue= cartonno} ,
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };

                List<tinppackingrecdtl> rs5 = baseDal.GetSelectedObjects<tinppackingrecdtl>(param5);

                for (int i = 0; i < rs5.Count; i++)
                {
                    string pksysid = rs5[i].pksysid;

                    List<MESParameterInfo> lstParamX = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="pksysid",ParamValue= pksysid}
                    };
                    baseDal.DoDelete<tinppackingrecretrieve>(lstParamX);
                }
                ////////////////////////////////////////////////////////////////////////////////

                dbInstance.Commit();
                return true;

            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                return false;
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
Esempio n. 3
0
        public bool OpenBoxDeleteBox(string customer, string cartonno, string poid, string user, string workgroup)
        {
            bool res = false;
            try
            {
                dbInstance.BeginTransaction();
                OpenBoxDal dal = new OpenBoxDal(dbInstance);
                //get detail record of opening  box  --tinppackingrecdtl
                List<MESParameterInfo> lstParam = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="custorderno",ParamValue=poid},
                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                        new MESParameterInfo(){ParamName="pktype",ParamValue=MES_PackingType.Unpacking.ToString()},
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };
                List<tinppackingrecdtl> ctlDtl = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam);
                //sum qty

                for (int i = 0; i < ctlDtl.Count; i++)
                {
                    //process wip---------------
                    WipDal wip = new WipDal(dbInstance);
                    wip.SaveOrUpdate(customer, ctlDtl[i].custorderno, ctlDtl[i].styleno, ctlDtl[i].color, ctlDtl[i].size, "I", workgroup, -1 * (int)ctlDtl[i].pairqty);
                }
                //delete opening detail
                baseDal.DoDelete<tinppackingrecdtl>(lstParam);
                //delete opening header
                if (ctlDtl.Count > 0)
                {
                    string sysid = ctlDtl[0].pksysid;
                    List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="pksysid",ParamValue=sysid}  };
                    baseDal.DoDelete<tinppackingrec>(lstParam2);

                    //update carton-location of receiving
                    localDal.UpdateCartonLocation(customer, poid, cartonno, user, MES_CartonLocation.Warehouse.ToString());
                }
                dbInstance.Commit();
                return true;
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
        /**取消开箱*/
        public bool cancelOpen(string customer, string cartonno, string poid, string user)
        {
            bool res = false;
            try
            {
                #region 没有开过箱
                if (!isOpened(customer, poid, cartonno))
                {
                    return true;
                }
                #endregion

                if (!isBoxing(customer, poid, cartonno))
                {
                    #region  开过箱但没有封箱
                    dbInstance.BeginTransaction();
                    OpenBoxDal dal = new OpenBoxDal(dbInstance);
                    //get checktype from receiving
                    List<MESParameterInfo> param = new List<MESParameterInfo>() {
                         new MESParameterInfo(){ParamName="custorderno",ParamValue=poid },
                         new MESParameterInfo(){ParamName="cartonno",ParamValue= cartonno} ,
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };

                    List<tinpreceivingctndtl> rs = baseDal.GetSelectedObjects<tinpreceivingctndtl>(param);
                    string checktype = rs[0].checktype;

                    //get detail record of opening  box  --tinppackingrecdtl
                    List<MESParameterInfo> lstParam = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="custorderno",ParamValue=poid},
                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                         new MESParameterInfo(){ParamName="pktype",ParamValue=MES_PackingType.Unpacking.ToString()},
                         new MESParameterInfo(){ParamName="customerid",ParamValue= customer}
                    };
                    List<tinppackingrecdtl> ctlDtl = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam);

                    string pksysid = ctlDtl[0].pksysid;

                    List<MESParameterInfo> lstParam1 = new List<MESParameterInfo>() {
                         new MESParameterInfo(){ParamName="pksysid",ParamValue=pksysid}
                    };
                    List<tinppackingrec> ctlDtl1 = baseDal.GetSelectedObjects<tinppackingrec>(lstParam1);
                    string oldWorkGroup = ctlDtl1[0].workgroup;

                    //sum qty

                    for (int i = 0; i < ctlDtl.Count; i++)
                    {
                        //process wip---------------
                        WipDal wip = new WipDal(dbInstance);
                        if (checktype == "X")
                        {
                            wip.SaveOrUpdate(customer, ctlDtl[i].custorderno, ctlDtl[i].styleno, ctlDtl[i].color, ctlDtl[i].size, "X", oldWorkGroup, -1 * (int)ctlDtl[i].pairqty, checktype);
                        }
                        if (checktype == "IX")
                        {
                            wip.SaveOrUpdate(customer, ctlDtl[i].custorderno, ctlDtl[i].styleno, ctlDtl[i].color, ctlDtl[i].size, "I", oldWorkGroup, -1 * (int)ctlDtl[i].pairqty, checktype);
                        }
                        if (checktype == "I")
                        {
                            wip.SaveOrUpdate(customer, ctlDtl[i].custorderno, ctlDtl[i].styleno, ctlDtl[i].color, ctlDtl[i].size, "I", oldWorkGroup, -1 * (int)ctlDtl[i].pairqty, checktype);
                        }

                    }
                    //delete opening detail
                    baseDal.DoDelete<tinppackingrecdtl>(lstParam);
                    //delete opening header
                    if (ctlDtl.Count > 0)
                    {
                        string sysid = ctlDtl[0].pksysid;
                        List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="pksysid",ParamValue=sysid}  };
                        baseDal.DoDelete<tinppackingrec>(lstParam2);

                        //update carton-location of receiving
                        localDal.UpdateCartonLocation(customer, poid, cartonno, user, MES_CartonLocation.Warehouse.ToString());
                    }

                    dbInstance.Commit();
                    return true;
                    #endregion
                }
                else
                {
                    return false;
                }

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