示例#1
0
        public string CheckGroup(DataTable dt)
        {
            try
            {
                dbInstance.BeginTransaction();
                string customerid = dt.Rows[0]["customerid"].ToString();
                string custorderno = dt.Rows[0]["poid"].ToString();
                string cartonno = dt.Rows[0]["cartonNumber"].ToString();
                string styleno = dt.Rows[0]["type"].ToString();
                string size = dt.Rows[0]["size"].ToString();
                string color = dt.Rows[0]["color"].ToString();
                string qty = dt.Rows[0]["qty"].ToString();

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

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

                #region 有没有入库信息
                OpenBoxDal dal = new OpenBoxDal(dbInstance);
                bool exist = dal.existsCarton(customerid, custorderno, cartonno);
                if (!exist)
                {
                    return "没有入库信息!";
                }
                #endregion

                List<MESParameterInfo> lstParam = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="customerid",ParamValue=customerid},
                        new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                       // new MESParameterInfo(){ParamName="styleno",ParamValue=styleno},
                       // new MESParameterInfo(){ParamName="size",ParamValue=size},
                       // new MESParameterInfo(){ParamName="color",ParamValue=color},
                        new MESParameterInfo(){ParamName="pktype",ParamValue="Packing"}
                    };
                List<tinppackingrecdtl> ctlDtl = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam);
                #region  已经封箱
                if (ctlDtl.Count > 0)
                {
                    if (ctlDtl[0].isshipped == "Y")
                    {
                        return "已经发货,不可修改";
                    }
                    else
                    {
                        return "已经封箱,不可修改";
                    }

                }
                # endregion
                #region   没有封箱记录
                else
                {
                    List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                          new MESParameterInfo(){ParamName="customerid",ParamValue=customerid},
                          new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                          new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                       // new MESParameterInfo(){ParamName="styleno",ParamValue=styleno},
                       // new MESParameterInfo(){ParamName="size",ParamValue=size},
                      //  new MESParameterInfo(){ParamName="color",ParamValue=color},
                          new MESParameterInfo(){ParamName="pktype",ParamValue="Unpacking"}
                      };
                    List<tinppackingrecdtl> ctlDtl2 = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam2);
                    #region    有开箱记录
                    if (ctlDtl2.Count > 0)
                    {
                        #region   IX 类型
                        if (checktype == "IX")
                        {  //有开箱记录,没有封箱记录,且是IX的
                            List<MESParameterInfo> lstParam3 = new List<MESParameterInfo>() {
                                        new MESParameterInfo(){ParamName="customerid",ParamValue=customerid},
                                        new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                                      //  new MESParameterInfo(){ParamName="styleno",ParamValue=styleno},
                                       // new MESParameterInfo(){ParamName="size",ParamValue=size},
                                       // new MESParameterInfo(){ParamName="color",ParamValue=color},
                                        new MESParameterInfo(){ParamName="pktype",ParamValue="Moving"}
                                      };
                            List<tinppackingrecdtl> ctlDtl3 = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam3);
                            if (ctlDtl3.Count > 0)
                            { //有开箱,已经moving,没封箱,且是IX,
                                return "OK";
                            }
                            else
                            {
                                //有开箱, 且是IX,但没有moving
                                return "没有经过检品装箱";
                            }
                        }
                        #endregion
                        #region   I类型 或 X 类型;有开箱,没有封箱记录
                        else
                        {
                            //有开箱记录单没有封箱记录,且不是IX的
                            return "OK";
                        }
                        #endregion
                    }
                    # endregion
                    #region  没有开箱记录
                    else
                    {
                        return "没有开箱记录";
                    }
                    # endregion
                }
                # endregion
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
示例#2
0
        public string MoveBoxCheckGroup(DataTable dt)
        {
            try
            {
                dbInstance.BeginTransaction();
                string customerid = dt.Rows[0]["customerid"].ToString();
                string custorderno = dt.Rows[0]["poid"].ToString();
                string cartonno = dt.Rows[0]["cartonNumber"].ToString();
                string styleno = dt.Rows[0]["type"].ToString();
                string size = dt.Rows[0]["size"].ToString();
                string color = dt.Rows[0]["color"].ToString();
                string qty = dt.Rows[0]["qty"].ToString();

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

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

                #region check reciveing
                OpenBoxDal dal = new OpenBoxDal(dbInstance);
                bool exist = dal.existsCarton(customerid, custorderno, cartonno);
                if (!exist)
                {
                    return "没有入库信息!";
                }
                #endregion

                List<MESParameterInfo> lstParam = new List<MESParameterInfo>() {
                     new MESParameterInfo(){ParamName="customerid",ParamValue=customerid},
                        new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                       // new MESParameterInfo(){ParamName="styleno",ParamValue=styleno},
                       // new MESParameterInfo(){ParamName="size",ParamValue=size},
                       // new MESParameterInfo(){ParamName="color",ParamValue=color},
                        new MESParameterInfo(){ParamName="pktype",ParamValue="Moving"}
                    };
                List<tinppackingrecdtl> ctlDtl = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam);

                if (ctlDtl.Count > 0)
                {
                    return "已经装箱";
                }
                else
                {
                    List<MESParameterInfo> lstParam2 = new List<MESParameterInfo>() {
                        new MESParameterInfo(){ParamName="customerid",ParamValue=customerid},
                        new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                        new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno},
                       // new MESParameterInfo(){ParamName="styleno",ParamValue=styleno},
                       // new MESParameterInfo(){ParamName="size",ParamValue=size},
                      //  new MESParameterInfo(){ParamName="color",ParamValue=color},
                        new MESParameterInfo(){ParamName="pktype",ParamValue="Unpacking"}
                      };
                    List<tinppackingrecdtl> ctlDtl2 = baseDal.GetSelectedObjects<tinppackingrecdtl>(lstParam2);
                    if (ctlDtl2.Count > 0)
                    {
                        if (checktype == "IX")
                        {  //有开箱记录,没有装箱记录,且是IX的
                            return "OK";
                        }
                        else
                        {
                            //有开箱记录,没有装箱记录,不是是IX的
                            return "需要直接封箱";
                        }
                    }
                    else
                    {
                        return "没有开箱记录";
                    }
                }
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
示例#3
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();
            }
        }
示例#4
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();
            }
        }
示例#5
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();
            }
        }
示例#6
0
        /** x线封箱不满箱暂时存放产线*/
        public bool lineWarehouseSave(DataTable dt, 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;
                decimal? ttlqty = 0;
                string custorderno = "";
                int dtl = dt.Rows.Count;

                //delete old carton if exists
                //delete line warehouse, if exists
                string customerid = dt.Rows[0]["customerid"].ToString();
                custorderno = dt.Rows[0]["poid"].ToString();
                string cartonno = dt.Rows[0]["cartonNumber"].ToString();

                //get checktype from receiving
                List<MESParameterInfo> lstParam = new List<MESParameterInfo>()
                       {
                           new MESParameterInfo(){ParamName="custorderno",ParamValue=custorderno},
                           new MESParameterInfo(){ParamName="cartonno",ParamValue=cartonno} ,
                            new MESParameterInfo(){ParamName="customerid",ParamValue=customerid}

                       };

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

                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);

                for (int i = 0; i < dtl; i++)
                {
                    //
                    tinplinewarehouse obj = new tinplinewarehouse();
                    obj.customerid = dt.Rows[i]["customerid"].ToString();
                    custorderno = dt.Rows[i]["poid"].ToString();
                    obj.custorderno = custorderno;
                    obj.cartonNumber = dt.Rows[i]["cartonNumber"].ToString();
                    obj.color = dt.Rows[i]["color"].ToString();
                    obj.size = dt.Rows[i]["size"].ToString();
                    obj.styleno = dt.Rows[i]["type"].ToString();

                    obj.step = "X";   //目前只有X线才暂存
                    decimal qty = decimal.Parse((dt.Rows[i]["qty2"].ToString()));
                    obj.pairqty = qty;
                    obj.checktype = checktype;

                    // obj.lastmodifiedtime =   DateTime.Now;
                    //  obj.user = user;
                    obj.workgroup = workGroup;

                    //insert opening box detail
                    localDal.DoInsert<tinplinewarehouse>(obj);

                }

                dbInstance.Commit();
                return true;
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                return false;
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
示例#7
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();
            }
        }
示例#8
0
 public OpenBoxBll(ContextInfo contextInfo)
     : base(contextInfo)
 {
     localDal = new OpenBoxDal(dbInstance);
     baseDal = localDal;
 }
示例#9
0
        /** check before save*/
        public String CheckGroup(DataTable dt)
        {
            // bool res = false;
            try
            {
                dbInstance.BeginTransaction();

                string customerid = dt.Rows[0]["customerid"].ToString();
                string custorderno = dt.Rows[0]["poid"].ToString();
                string cartonno = dt.Rows[0]["cartonNumber"].ToString();
                string styleno = dt.Rows[0]["type"].ToString();
                string size = dt.Rows[0]["size"].ToString();
                string color = dt.Rows[0]["color"].ToString();
                string qty = dt.Rows[0]["qty"].ToString();
                string status = MES_CartonStatus.Active.ToString();
                string cartonlocation = MES_CartonLocation.Warehouse.ToString();

                #region check reciveing
                OpenBoxDal dal = new OpenBoxDal(dbInstance);
                bool exist = dal.existsCarton(customerid, custorderno, cartonno);
                if (!exist)
                {
                    return "NoCarton";
                }
                #endregion

                #region alread pack / box
                bool isBoxing = dal.isBoxing(customerid, custorderno, cartonno);
                if (isBoxing)
                {
                    return "boxing";
                }
                #endregion

                #region alread unpack
                bool opened = dal.isOpened(customerid, custorderno, cartonno);
                string result = "";
                if (opened)
                {
                    result = result + "Opened";
                }
                #endregion
                #region roupsEquals
                int groups = dt.Rows.Count;
                bool groupsEquals = dal.groupsEquals(customerid, custorderno, cartonno, groups);
                if (!groupsEquals)
                {
                    result = result + "|groupMiss";
                }

                #endregion

                for (int i = 0; i < groups; i++)
                {
                    string customerid2 = dt.Rows[i]["customerid"].ToString();
                    string custorderno2 = dt.Rows[i]["poid"].ToString();
                    string cartonno2 = dt.Rows[i]["cartonNumber"].ToString();
                    string styleno2 = dt.Rows[i]["type"].ToString();
                    string size2 = dt.Rows[i]["size"].ToString();
                    string color2 = dt.Rows[i]["color"].ToString();
                    string qty2 = dt.Rows[i]["qty"].ToString();
                    bool existsGroup = dal.existsGroup(customerid, custorderno, cartonno, styleno2, color2, size2, qty2);
                    if (!existsGroup)
                    {
                        result = result + "|NOGroup";
                    }
                }
                if (result.Length > 0)
                {
                    return result;
                }
                return "OK";
                dbInstance.Commit();

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