Esempio n. 1
0
        void AddRow()
        {
            FrmChooseMaterial frmItemEdit = new FrmChooseMaterial(null);

            frmItemEdit.OnInsertItem += delegate(MaterialEntity material, decimal qty)
            {
                List <PODetailEntity> lines = bindingSource1.DataSource as List <PODetailEntity>;
                PODetailEntity        line  = lines.Find(d =>
                                                         d.MaterialCode == material.MaterialCode &&
                                                         d.Price == material.Price);
                if (line != null)
                {
                    line.PlanQty = line.PlanQty + qty;
                }
                else
                {
                    line         = new PODetailEntity();
                    line.PlanQty = qty;
                    line.Copy(material);
                    bindingSource1.Add(line);
                }

                bindingSource1.ResetBindings(false);
            };
            frmItemEdit.ShowDialog();
        }
Esempio n. 2
0
        /// <summary>
        /// 更新订单明细的收货量
        /// </summary>
        public int SaveOverStock(PODetailEntity entity)
        {
            string sql = "UPDATE wm_asn_detail wad SET wad.PUT_QTY = {0},wad.LAST_UPDATETIME=NOW()  WHERE wad.ID = {1}";

            IMapper map = DatabaseInstance.Instance();

            return(map.Execute(String.Format(sql, entity.PutQty, entity.DetailID)));
        }
Esempio n. 3
0
        /// <summary>
        /// 查看是否可以保存了
        /// 检查必填项
        /// </summary>
        /// <returns></returns>
        bool CanSave()
        {
            //采购单是否必须选择?
            if (string.IsNullOrEmpty(txtPO.Text))
            {
                MsgBox.Warn("请选择采购单。");
                return(false);
            }

            //
            if (listRespPerson.EditValue == null)
            {
                MsgBox.Warn("请选择业务员。");
                return(false);
            }

            if (listSupplier.EditValue == null)
            {
                MsgBox.Warn("请选择供应商。");
                return(false);
            }

            gridView1.CloseEditor();

            //至少有一行明细
            if (bindingSource1.Count == 0)
            {
                MsgBox.Warn("请填写明细行。");
                return(false);
            }

            //查看明细是否填充完整:物料编码与数量
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                PODetailEntity line = gridView1.GetRow(i) as PODetailEntity;
                if (!line.PlanQty.HasValue || line.PlanQty.Value <= 0)
                {
                    MsgBox.Warn(string.Format("第{0}行数量填写有误,必须为大于0的数值。", i + 1));
                    return(false);
                }
            }

            //查看是否有相同的物料,提示合并,让用户自己合并
            if (HasSameMaterial())
            {
                if (MsgBox.AskYes("明细中存在相同的物料编码行,建议先合并再保存?选择“是”将继续,“否”将返回。") == DialogResult.No)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 4
0
        /// <summary>
        /// 越库收货确认
        /// </summary>
        public string SaveOverStock(PODetailEntity entity, string targetLocCode, string whCode)
        {
            IMapper           map   = DatabaseInstance.Instance();
            DynamicParameters param = new DynamicParameters();

            param.Add("V_DETAIL_ID", entity.DetailID);
            param.Add("V_PUT_QTY", entity.PutQty);
            param.Add("V_TARGET_LC_CODE", targetLocCode);
            param.Add("V_WH_CODE", whCode);
            param.AddOut("V_RESULT_MSG", DbType.String);
            map.Execute("P_ASN_OVERSTOCK_SAVE", param, CommandType.StoredProcedure);
            return(param.Get <string>("V_RESULT_MSG"));
        }
Esempio n. 5
0
        /// <summary>
        /// 越库收货确认
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="targetLocCode"></param>
        /// <param name="whCode"></param>
        /// <returns></returns>
        public bool SaveOverStock(PODetailEntity entity, string targetLocCode, string whCode, string username)
        {
            try
            {
                #region 请求数据
                System.Text.StringBuilder loStr = new System.Text.StringBuilder();
                //loStr.Append("detailId=").Append(entity.DetailID).Append("&");
                //loStr.Append("putQty=").Append(entity.PutQty).Append("&");
                loStr.Append("entity=").Append(JsonConvert.SerializeObject(entity)).Append("&");
                loStr.Append("userName="******"targetLcCode=").Append(targetLocCode).Append("&");
                loStr.Append("whCode=").Append(whCode);
                string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_SaveOverStockOK);
                if (string.IsNullOrEmpty(jsonQuery))
                {
                    MsgBox.Warn(WebWork.RESULT_NULL);
                    return(false);
                }
                #endregion

                #region 正常错误处理

                Sucess bill = JsonConvert.DeserializeObject <Sucess>(jsonQuery);
                if (bill == null)
                {
                    MsgBox.Warn(WebWork.JSON_DATA_NULL);
                    return(false);
                }
                if (bill.flag != 0)
                {
                    MsgBox.Warn(bill.error);
                    return(false);
                }
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }

            return(false);
        }
Esempio n. 6
0
        /// <summary>
        /// 收货单据管理, 查询入库单明细
        /// </summary>
        /// <param name="billID"></param>
        /// <returns></returns>
        public List <PODetailEntity> GetDetailByBillID(int billID)
        {
            List <PODetailEntity> list = new List <PODetailEntity>();

            try
            {
                #region 请求数据
                System.Text.StringBuilder loStr = new System.Text.StringBuilder();
                loStr.Append("billId=").Append(billID);
                string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetDetailByBillID);
                if (string.IsNullOrEmpty(jsonQuery))
                {
                    MsgBox.Warn(WebWork.RESULT_NULL);
                    //LogHelper.InfoLog(WebWork.RESULT_NULL);
                    return(list);
                }
                #endregion

                #region 正常错误处理

                JsonGetDetailByBillID bill = JsonConvert.DeserializeObject <JsonGetDetailByBillID>(jsonQuery);
                if (bill == null)
                {
                    MsgBox.Warn(WebWork.JSON_DATA_NULL);
                    return(list);
                }
                if (bill.flag != 0)
                {
                    MsgBox.Warn(bill.error);
                    return(list);
                }
                #endregion

                #region 赋值数据
                foreach (JsonGetDetailByBillIDResult jbr in bill.result)
                {
                    PODetailEntity asnEntity = new PODetailEntity();
                    asnEntity.Barcode1 = jbr.barCode1;
                    asnEntity.BatchNO  = jbr.batchNo;
                    asnEntity.BillID   = Convert.ToInt32(jbr.billId);
                    asnEntity.DetailID = Convert.ToInt32(jbr.id);
                    asnEntity.ExpDate  = jbr.expDate;
                    //asnEntity.MaterialName = jbr.namePy;
                    asnEntity.MaterialName  = jbr.skuName;
                    asnEntity.MaterialNameS = jbr.skuNameS;
                    asnEntity.MaterialCode  = jbr.skuCode;
                    asnEntity.PlanQty       = Convert.ToInt32(jbr.qty);
                    asnEntity.Price         = jbr.price;
                    asnEntity.PutQty        = Convert.ToInt32(jbr.putQty);
                    asnEntity.Remark        = jbr.remark;
                    asnEntity.Spec          = jbr.spec;
                    asnEntity.UnitName      = jbr.umName;
                    list.Add(asnEntity);
                }
                return(list);

                #endregion
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
            return(list);
        }