示例#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
        /** 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();
            }
        }