Beispiel #1
0
        // D:客户退货单 A:采购入库 F:采购退货 G:调拨单
        void IInOutBLL.CheckInOut(string sheet_no, string approve_man, DateTime update_time)
        {
            var db = new DB.DBByAutoClose(Appsetting.conn);

            DB.IDB d = db;
            try
            {
                //
                string sql = "select trans_no,approve_flag,update_time from ic_t_inout_store_master where sheet_no='" + sheet_no + "'";
                var    tb  = d.ExecuteToTable(sql, null);
                if (tb.Rows.Count == 0)
                {
                    throw new Exception("单据不存在[" + sheet_no + "]");
                }

                ic_t_inout_store_master master = d.ExecuteToModel <ic_t_inout_store_master>("select * from ic_t_inout_store_master where sheet_no='" + sheet_no + "'", null);

                CheckSheet check = new CheckSheet();
                switch (master.trans_no)
                {
                case "A":
                    check.CheckPISheet(sheet_no, approve_man, update_time);
                    break;

                case "D":
                    check.CheckRISheet(sheet_no, approve_man, update_time);
                    break;

                case "F":
                    check.CheckROSheet(sheet_no, approve_man, update_time);
                    break;

                case "G":
                    check.CheckIOSheet(sheet_no, approve_man, update_time);
                    break;

                case "I":
                    check.CheckSOSheet(sheet_no, approve_man, update_time);
                    break;

                default:
                    check.CheckOOSheet(sheet_no, approve_man, update_time);
                    break;
                }
            }
            catch (Exception ex)
            {
                LogHelper.writeLog("InOutBLL.CheckInOut()", ex.ToString(), sheet_no, approve_man);
                throw ex;
            }
        }
Beispiel #2
0
        void IInOutBLL.AssAddCG(ic_t_inout_store_master ord, List <ic_t_inout_store_detail> lines, out string sheet_no)
        {
            JsonRequest r = new JsonRequest();

            r.Write(ord);
            r.Write("lines", lines);

            r.request("/inout?t=AssAddCG");

            if (!r.ReadSuccess())
            {
                throw new Exception(r.ReadMessage());
            }

            sheet_no = r.Read("sheet_no");
        }
Beispiel #3
0
        void IOrder.Save()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (txt_trans_no.Text.Trim().Contains("/") == false)
                {
                    MsgForm.ShowFrom("业务类型必填!");
                    return;
                }
                if (txtbranch.Text.Trim().Contains("/") == false)
                {
                    MsgForm.ShowFrom("机构必填!");
                    return;
                }
                if (txtoper_date.Text.Trim() == "")
                {
                    MsgForm.ShowFrom("单据日期必填!");
                    return;
                }

                ic_t_inout_store_master        ord   = new ic_t_inout_store_master();
                List <ic_t_inout_store_detail> lines = new List <ic_t_inout_store_detail>();
                ord.sheet_no     = txtsheet_no.Text.Trim();
                ord.trans_no     = txt_trans_no.Text.Trim().Split('/')[0];
                ord.branch_no    = txtbranch.Text.Trim().Split('/')[0];
                ord.voucher_no   = "";
                ord.supcust_no   = "";
                ord.pay_way      = "";
                ord.discount     = 1;
                ord.coin_no      = "RMB";
                ord.tax_amount   = 0;
                ord.oper_date    = Helper.Conv.ToDateTime(txtoper_date.Text.Trim());
                ord.oper_id      = txtoper_man.Text.Split('/')[0];
                ord.deal_man     = txt_deal_man.Text.Split('/')[0];
                ord.cm_branch    = "00";
                ord.other1       = txt_other3.Text.Trim();
                ord.other2       = "";
                ord.other3       = txt_other3.Text.Trim();
                ord.old_no       = txt_old_no.Text;
                ord.num1         = 0;
                ord.num2         = 0;
                ord.num3         = 0;
                ord.sale_no      = "";
                ord.approve_flag = "0";
                ord.approve_man  = txtapprove_man.Text.Split('/')[0];
                ord.approve_date = System.DateTime.MinValue;
                ord.pay_date     = System.DateTime.MinValue;
                ord.update_time  = update_time;

                int     flag      = 0;
                int     index     = 0;
                decimal total_amt = 0;
                foreach (DataRow row in editGrid1.DataSource.Rows)
                {
                    ++index;
                    if (row["item_no"].ToString() != "")
                    {
                        ic_t_inout_store_detail line = new ic_t_inout_store_detail();
                        lines.Add(line);
                        line.sheet_no    = ord.sheet_no;
                        line.item_no     = row["item_no"].ToString();
                        line.item_name   = row["item_name"].ToString();
                        line.unit_no     = row["unit_no"].ToString();
                        line.barcode     = row["barcode"].ToString();
                        line.unit_factor = 1;
                        line.in_qty      = Helper.Conv.ToDecimal(row["in_qty"].ToString());
                        line.orgi_price  = 0;
                        line.valid_price = Helper.Conv.ToDecimal(row["valid_price"].ToString());
                        line.cost_price  = 0;
                        line.sub_amount  = Helper.Conv.ToDecimal(row["sub_amount"].ToString());
                        line.discount    = 1;
                        line.tax         = 0;
                        line.is_tax      = "0";
                        line.valid_date  = DateTime.MinValue;
                        line.other1      = row["other1"].ToString();
                        line.other2      = "";
                        line.other3      = "";
                        line.voucher_no  = "";
                        line.sheet_sort  = index;
                        line.ret_qnty    = 0;
                        line.num1        = 0;
                        line.num2        = 0;
                        line.num3        = 0;
                        line.num4        = 0;
                        line.num5        = 0;
                        line.num6        = 0;
                        line.cost_notax  = 0;
                        line.packqty     = 0;
                        line.sgqty       = 0;
                        flag             = 1;
                        total_amt       += line.in_qty * line.valid_price;
                    }
                }
                if (flag == 0)
                {
                    MsgForm.ShowFrom("请输入表单明细");
                    return;
                }
                ord.inout_amount = total_amt;
                ord.total_amount = total_amt;
                IBLL.IInOutBLL bll = new BLL.InOutBLL();
                if (runType == 1)
                {
                    var sheet_no = "";
                    bll.AddInOut(ord, lines, out sheet_no);
                    IOrder ins = this;
                    ins.ShowOrder(sheet_no);
                }
                else if (runType == 2)
                {
                    bll.ChangeInOut(ord, lines);
                    IOrder ins = this;
                    ins.ShowOrder(ord.sheet_no);
                }

                Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                this.Tag = Helper.Conv.ControlsAdds(this, dic);

                IBLL.ISys sys       = new BLL.SysBLL();
                string    isApprove = sys.Read("approve_at_ones");
                if ("1".Equals(isApprove))
                {
                    if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes)
                    {
                        tsbCheck_Click(new object(), new EventArgs());
                    }
                }
            }
            catch (Exception ex)
            {
                Helper.LogHelper.writeLog("frmOtherInOutSheet->Save()", ex.ToString(), txtsheet_no.Text);
                MsgForm.ShowFrom("其它出入单保存异常[" + ex.Message + "]");
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }