示例#1
0
        /**作者:周雅雯 修改时间:2016/7/30
         * 入库按钮对应的操作
         */
        public Boolean inStorage(string receipt_no)
        {
            //1.比较暂收数量(Rec_Qty)和允收量,若不相等则把入库量(deliver_qty)修改为允收量(Accepted_qty)
            Receive_mtlDC receive_dc1 = new Receive_mtlDC();
            Boolean       flag1       = receive_dc1.CompareRec_QtyAndAccepted_qty(receipt_no);

            //2.修改庫存總表庫存量,庫存明細表里對應的料號+datecode 的數量
            Receive_mtlDC receive_dc2 = new Receive_mtlDC();
            Boolean       flag2       = receive_dc2.updateOnhand_quantiyAndOnhand_qtyByReceipt_no(receipt_no);

            //通过暂收单号获取入库量
            Receive_mtlDC receive_dc3 = new Receive_mtlDC();
            int           deliver_qty = receive_dc3.getDeliver_qtyByReceipt_no(receipt_no);

            if (deliver_qty == -1)  //获取入库量失败时
            {
                return(false);
            }

            //3.在交易表中插入入庫信息
            Transaction_operationDC transaction_operationdc = new Transaction_operationDC();
            DateTime transaction_time = DateTime.Now;
            Boolean  flag3            = transaction_operationdc.insertTransaction_operation(deliver_qty, "ruku", transaction_time);

            if (flag1 == true && flag2 == true && flag3 == true)  //当且仅当三个操作都满足要求时,返回true
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /**作者周雅雯,时间:2016/7/26
         * 比较暂收数量(rcv_qty)和允收量(Accepted_qty )是否相等,
         * 若不相等则把入库量(deliver_qty)修改为允收量(Accepted_qty)
         * **/
        public Boolean CompareRec_QtyAndAccepted_qty(string receipt_no)
        {
            //通过SQL语句,获取DateSet
            string sql = "select rcv_qty,Accepted_qty from wms_receive_mtl where receipt_no = @receipt_no";

            SqlParameter[] parameters =
            {
                new SqlParameter("receipt_no", receipt_no)
            };

            DB.connect();

            DataSet ds = DB.select(sql, parameters);

            if (ds != null)   //查询操作成功
            {
                //比较暂收数量(Rec_Qty)和允收量(Accepted_qty )

                //如果不等
                if (ds.Tables[0].Rows[0]["rcv_qty"] != ds.Tables[0].Rows[0]["Accepted_qty"])
                {
                    Receive_mtlDC receive_dc = new Receive_mtlDC();
                    Boolean       flag;

                    //则把入库量(deliver_qty)修改为允收量(Accepted_qty)
                    flag = receive_dc.updateDeliver_qtyByReceipt_no(receipt_no);
                    if (flag == true)   //修改成功
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                //如果相等,则返回真,不修改
                else
                {
                    return(true);
                }
            }
            else            //查询操作失败
            {
                return(false);
            }
        }