Beispiel #1
0
        private void UpdateCancelFlag(bool isCancel)
        {
            ORD_PurchaseOrderLogic logic = new ORD_PurchaseOrderLogic(this);

            if (poguid == null)
            {
                this.ShowMessage("请先保存新增的数据!");
                return;
            }
            if (isCancel)
            {
                if (MessageBox.Show("是否真的取消当前单据?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            else
            {
                if (MessageBox.Show("是否真的恢复当前单据?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            ORD_PurchaseOrderResult param = new ORD_PurchaseOrderResult();

            param.POGuid   = poguid;
            param.IsCancel = isCancel;
            WCFAddUpdateResult rst = logic.UpdateCancelFlag(param);

            if (rst.Key > 0)
            {
                InitData();
            }
        }
Beispiel #2
0
 Guid poLineGuid;//采购明细GUID
 //string poBillNo = null;//明细所在订单号
 public frmPurchaseManage()
 {
     InitializeComponent();
     appHandler     = new Logic.AppHandler.SearchAssembleHandler(this);
     dictLineLogic  = new SYS_DictItemLineLogic(this);
     orderLogic     = new ORD_PurchaseOrderLogic(this);
     orderLineLogic = new ORD_PurchaseOrderLineLogic(this);//初始化订单明细
     //poBillNo = "";//初始化明细所在订单号
 }
Beispiel #3
0
 void InitForm(bool isMutiSelect, ORD_PurchaseOrderParam param)
 {
     InitializeComponent();
     InitBaseSelectForm(isMutiSelect, this.dgvPurchaseOrder, this.chkAll, _idColName, _chkColName);
     orderLogic = new ORD_PurchaseOrderLogic(this);
     if (param != null)
     {
         _StkInOccStatusArr = param.StkInOccStatusArr;
     }
 }
Beispiel #4
0
 public frmPurchaseReturn()
 {
     InitializeComponent();
     dictLineLogic = new SYS_DictItemLineLogic(this);
     orgLogic      = new HR_OrgLogic(this);
     returnLogic   = new ORD_PurchaseReturnLogic(this);
     inLineLogic   = new STK_InLineLogic(this);
     companyLogic  = new CRM_CompanyLogic(this);
     orderLogic    = new ORD_PurchaseOrderLogic(this);
 }
Beispiel #5
0
 public frmPurchaseOrder()
 {
     InitializeComponent();
     this.GetEditEntity += new dlgGetEditEntity(Form_GetEditEntity);
     dictLineLogic       = new SYS_DictItemLineLogic(this);
     orgLogic            = new HR_OrgLogic(this);
     orderLogic          = new ORD_PurchaseOrderLogic(this);
     orderLineLogic      = new ORD_PurchaseOrderLineLogic(this);
     companyLogic        = new CRM_CompanyLogic(this);
     noticeLogic         = new ORD_PurchaseNoticeLogic(this);
     salesOrderLineLogic = new ORD_SalesOrderLineLogic(this);
 }
Beispiel #6
0
 void InitForm(string billType, Guid?sourceBillGuid)
 {
     InitializeComponent();
     this.GetEditEntity += new dlgGetEditEntity(Form_GetEditEntity);
     dictLineLogic       = new SYS_DictItemLineLogic(this);
     orgLogic            = new HR_OrgLogic(this);
     purOrderLogic       = new ORD_PurchaseOrderLogic(this);
     purLineLogic        = new ORD_PurchaseOrderLineLogic(this);
     stkInLogic          = new STK_InLogic(this);
     companyLogic        = new CRM_CompanyLogic(this);
     currencyLogic       = new SYS_CurrencyLogic(this);
     stkStockLogic       = new STK_StockLogic(this);
     stkInLineLogic      = new STK_InLineLogic(this);
     stkStockSheetLogic  = new STK_StockSheetLogic(this);
     returnLogic         = new ORD_SalesReturnLogic(this);
     returnLineLogic     = new ORD_SalesReturnLineLogic(this);
     BillType            = billType;
     _sourceBillGuid     = sourceBillGuid;
 }
Beispiel #7
0
        private void GetLastHistoryPrice(string oprType)
        {
            string        supplierName = "";
            int           supplierID   = 0;
            List <string> modelList    = new List <string>();
            List <string> brandList    = new List <string>();

            #region 供应商名称
            supplierID   = this.txtSupplierID.Text.ToInt32();
            supplierName = this.txtSupplierName.Text;
            if (supplierName.Trim() == "" || supplierID <= 0)
            {
                return;
            }
            #endregion
            #region 更改了供应商
            if (oprType == "supplier")
            {
                foreach (DataGridViewRow row in this.dgvPurchaseOrderLine.Rows)
                {
                    if (row.Cells["colModel"].Value.ToStringHasNull().Trim() == "")
                    {
                        continue;
                    }
                    if (row.Cells["colNTaxPrice"].Tag.ToDecimal() != row.Cells["colNTaxPrice"].Value.ToDecimal() &&
                        row.Cells["colUnitPrice"].Tag.ToDecimal() != row.Cells["colUnitPrice"].Value.ToDecimal())
                    {
                        continue;
                    }
                    modelList.Add(row.Cells["colModel"].Value.ToStringHasNull());
                    if (row.Cells["colBrand"].Value.ToStringHasNull().Trim() != "" && !brandList.Contains(row.Cells["colBrand"].Value.ToStringHasNull().Trim()))
                    {
                        brandList.Add(row.Cells["colBrand"].Value.ToStringHasNull());
                    }
                }
            }
            #endregion
            #region 更改了型号和品牌
            else if ((oprType == "model" || oprType == "brand") && this.dgvPurchaseOrderLine.CurrentCell != null)
            {
                DataGridViewRow row = this.dgvPurchaseOrderLine.Rows[this.dgvPurchaseOrderLine.CurrentCell.RowIndex];
                if (row.Cells["colModel"].Value.ToStringHasNull().Trim() != "" &&
                    (row.Cells["colNTaxPrice"].Tag.ToDecimal() == row.Cells["colNTaxPrice"].Value.ToDecimal() ||
                     row.Cells["colUnitPrice"].Tag.ToDecimal() == row.Cells["colUnitPrice"].Value.ToDecimal()))
                {
                    modelList.Add(row.Cells["colModel"].Value.ToStringHasNull());
                    if (row.Cells["colBrand"].Value.ToStringHasNull().Trim() != "" &&
                        !brandList.Contains(row.Cells["colBrand"].Value.ToStringHasNull().Trim()))
                    {
                        brandList.Add(row.Cells["colBrand"].Value.ToStringHasNull());
                    }
                }
            }
            #endregion
            #region 获取历史单价
            if (modelList.Count <= 0)
            {
                return;
            }
            ORD_PurchaseOrderLogic logic = new ORD_PurchaseOrderLogic(this);
            ORD_PurchaseOrderParam param = new ORD_PurchaseOrderParam();
            param.SupplierID = supplierID;
            param.ModelList  = modelList.ToArray();
            param.BrandList  = brandList.ToArray();
            List <ORD_PurchaseOrderLineResult> rst = logic.GetLastHisstoryPrice(param);
            #endregion
            string model = "", brand = "";
            ORD_PurchaseOrderLineResult findInfo = new ORD_PurchaseOrderLineResult();
            #region 更改了供应商
            if (oprType == "supplier")
            {
                foreach (DataGridViewRow row in this.dgvPurchaseOrderLine.Rows)
                {
                    if (row.Cells["colModel"].Value.ToStringHasNull().Trim() == "")
                    {
                        continue;
                    }
                    if (row.Cells["colNTaxPrice"].Tag.ToDecimal() != row.Cells["colNTaxPrice"].Value.ToDecimal() &&
                        row.Cells["colUnitPrice"].Tag.ToDecimal() != row.Cells["colUnitPrice"].Value.ToDecimal())
                    {
                        continue;
                    }
                    model = row.Cells["colModel"].Value.ToStringHasNull().ToLower();
                    brand = row.Cells["colBrand"].Value.ToStringHasNull().ToLower();
                    if (brand.ToStringHasNull().Trim() == "")
                    {
                        findInfo = rst.Find(a => a.Model.ToLower() == model);
                    }
                    else
                    {
                        findInfo = rst.Find(a => a.Model.ToLower() == model && a.Brand.ToStringHasNull().ToLower() == brand);
                    }
                    if (findInfo != null)
                    {
                        row.Cells["colUnitPrice"].Value = findInfo.UnitPrice;
                        row.Cells["colNTaxPrice"].Value = findInfo.NTaxPrice;
                        row.Cells["colUnitPrice"].Tag   = findInfo.UnitPrice;
                        row.Cells["colNTaxPrice"].Tag   = findInfo.NTaxPrice;
                    }
                    else
                    {
                        row.Cells["colUnitPrice"].Value = "";
                        row.Cells["colNTaxPrice"].Value = "";
                        row.Cells["colUnitPrice"].Tag   = null;
                        row.Cells["colNTaxPrice"].Tag   = null;
                    }
                }
            }
            #endregion
            #region 更改了型号和品牌
            else if ((oprType == "model" || oprType == "brand") && this.dgvPurchaseOrderLine.CurrentCell != null)
            {
                DataGridViewRow row = this.dgvPurchaseOrderLine.Rows[this.dgvPurchaseOrderLine.CurrentCell.RowIndex];
                if (row.Cells["colModel"].Value.ToStringHasNull().Trim() == "")
                {
                    return;
                }
                if (row.Cells["colNTaxPrice"].Tag.ToDecimal() != row.Cells["colNTaxPrice"].Value.ToDecimal() &&
                    row.Cells["colUnitPrice"].Tag.ToDecimal() != row.Cells["colUnitPrice"].Value.ToDecimal())
                {
                    return;
                }
                model = row.Cells["colModel"].Value.ToStringHasNull().ToLower();
                brand = row.Cells["colBrand"].Value.ToStringHasNull().ToLower();
                if (brand.ToStringHasNull().Trim() == "")
                {
                    findInfo = rst.Find(a => a.Model.ToLower() == model);
                }
                else
                {
                    findInfo = rst.Find(a => a.Model.ToLower() == model && a.Brand.ToStringHasNull().ToLower() == brand);
                }
                if (findInfo != null)
                {
                    row.Cells["colUnitPrice"].Value = findInfo.UnitPrice;
                    row.Cells["colNTaxPrice"].Value = findInfo.NTaxPrice;
                    row.Cells["colUnitPrice"].Tag   = findInfo.UnitPrice;
                    row.Cells["colNTaxPrice"].Tag   = findInfo.NTaxPrice;
                }
                else
                {
                    row.Cells["colUnitPrice"].Value = "";
                    row.Cells["colNTaxPrice"].Value = "";
                    row.Cells["colUnitPrice"].Tag   = null;
                    row.Cells["colNTaxPrice"].Tag   = null;
                }
            }
            #endregion
        }