Esempio n. 1
0
    public bool CheckTallyBox(int tallyBillId, int region, string strBoxNo, out string strOldPalletNo, out string strMsg)
    {
        BTallyBillDetailBB tallyBillDetailBB = new BTallyBillDetailBB();
        BArrangeBillBoxBB arrangeBillBox = new BArrangeBillBoxBB();

        try
        {
            strMsg = "";
            strOldPalletNo = "";

            string strPreMaterialNo = "", strCurrMaterialNo = "";
            bool isExistsBox = false, isBoxAllowTally = false;
            DataTable dt = new DataTable();

            //判断箱号是否存在
            isExistsBox = this.IsExistsBox(strBoxNo);
            if (isExistsBox == false)
            {
                strMsg = "当前箱号不存在!";
                return false;
            }

            //判断当前箱子是否已经理货
            isBoxAllowTally = this.IsBoxAllowTally(strBoxNo);
            if (!isBoxAllowTally)
            {
                strMsg = "当前箱子已经理货!";
                return false;
            }

            //根据箱号,查找所在的托盘条码号
            strOldPalletNo = this.GetPalletNoByBoxNo(strBoxNo);
            if (strOldPalletNo == "")
            {
                strMsg = "当前箱子不属于任何托盘!";
                return false;
            }

            //判断同一区域箱数是否超过5个
            dt = tallyBillDetailBB.GetVList("mainId='" + tallyBillId.ToString() + "' and region='" + region.ToString() + "'").Tables[0];
            if (dt.Rows.Count >= 5)
            {
                strMsg = "";
                return false;
            }

            //判断同一托内区域,物料是否相同

            //根据箱号,查找物料是否符合排托规范

            //

            return true;
        }
        finally
        {
            tallyBillDetailBB.Dispose();
            arrangeBillBox.Dispose();
        }
    }
Esempio n. 2
0
    public DataTable GetTallyBillDetail(string strPalletNo)
    {
        BTallyBillDetailBB tallyBillDetailBB = new BTallyBillDetailBB();

        try
        {
            DataTable dt = new DataTable();

            dt = tallyBillDetailBB.GetVList("palletNo='" + strPalletNo + "' and isInStock=0").Tables[0];
            return dt;
        }
        finally
        {
            tallyBillDetailBB.Dispose();
        }
    }
Esempio n. 3
0
    public bool IsBoxAllowTally(string strBoxNo)
    {
        BTallyBillDetailBB tallyBillDetailBB = new BTallyBillDetailBB();

        try
        {
            DataTable dt = new DataTable();

            dt = tallyBillDetailBB.GetList("boxNo='" + strBoxNo + "'").Tables[0];
            return dt.Rows.Count > 0 ? false : true;
        }
        finally
        {
            tallyBillDetailBB.Dispose();
        }
    }
Esempio n. 4
0
    public int GetBoxSuggestRegin_Tally(int tallyBillId, string strMaterialNo)
    {
        SCommBB commBB = new SCommBB();
        BTallyBillDetailBB tallyBillDetailBB = new BTallyBillDetailBB();

        try
        {
            DataTable dtTallyBillDetail = new DataTable();
            DataRow[] myDataRowArray = null;
            StringBuilder strSql = new StringBuilder();
            int region = 0;

            //汇总托盘区域内物料箱数
            strSql.Append("select region,materialNo,count(1) as boxNum ");
            strSql.Append("from dbo.vBTallyBillDetail ");
            strSql.Append("where mainId=" + tallyBillId.ToString() + " ");
            strSql.Append("group by region,materialNo ");
            strSql.Append("order by region");

            dtTallyBillDetail = commBB.Query(strSql.ToString()).Tables[0];
            if (dtTallyBillDetail.Rows.Count > 0)//当前理货单已理货
            {
                //获取当前物料的所有排托信息
                myDataRowArray = dtTallyBillDetail.Select("materialNo='" + strMaterialNo + "'");
                if (myDataRowArray.Length > 0)//当前物料已进行理货
                {
                    //判断放置物料的最后一个区域箱数
                    if (Convert.ToInt32(myDataRowArray[myDataRowArray.Length - 1]["boxNum"]) < 5)
                    {
                        //未超出5箱,使用物料的最后一个区域
                        region = Convert.ToInt32(myDataRowArray[myDataRowArray.Length - 1]["region"]);
                    }
                    else//最后一个物料的区域已达到5箱
                    {
                        //查找放置此物料未满的区域
                        myDataRowArray = dtTallyBillDetail.Select("materialNo='" + strMaterialNo + "' and boxNum<5");
                        if (myDataRowArray.Length > 0)
                        {
                            region = Convert.ToInt32(myDataRowArray[0]["region"]);
                        }
                        else
                        {
                            //查找其他区域
                            for (int i = 1; i <= 8; i++)
                            {
                                myDataRowArray = dtTallyBillDetail.Select("region=" + i.ToString());
                                if (myDataRowArray.Length == 0)
                                {
                                    region = i;
                                    break;
                                }
                            }
                        }
                    }
                }
                else//当前物料未进行理货,取使用的最大区域加1
                {
                    region = Convert.ToInt32(dtTallyBillDetail.Rows[dtTallyBillDetail.Rows.Count - 1]["region"]) + 1;

                    if (region > 8)//推荐区域超出8,逐个查找没有使用的区域
                    {
                        for (int i = 1; i <= 8; i++)
                        {
                            myDataRowArray = dtTallyBillDetail.Select("region=" + i.ToString());
                            if (myDataRowArray.Length == 0)
                            {
                                region = i;
                                break;
                            }
                        }
                    }
                }
            }
            else//当前理货单还未理货
            {
                region = 1;
            }

            return region;
        }
        finally
        {
            commBB.Dispose();
            tallyBillDetailBB.Dispose();
        }
    }