コード例 #1
0
ファイル: FrmCountExecute.cs プロジェクト: uwitec/wms-1
        private void listBillNO_EditValueChanged(object sender, EventArgs e)
        {
            CountHeaderEntity header = listBillNO.GetSelectedDataRow() as CountHeaderEntity;

            if (header != null)
            {
                labelControl3.Text      = header.CreateDate.ToLongDateString();
                gridControl2.DataSource = GetReportOnlyDiff(header.BillID);
            }
        }
コード例 #2
0
        private void DoViewReport()
        {
            CountHeaderEntity header = SelectedCountHeader;

            if (header == null)
            {
                MsgBox.Err("请选中要查看的盘点单。");
                return;
            }

            FrmCountRecordVsStock frmReport = new FrmCountRecordVsStock(header.BillID);

            frmReport.ShowDialog();
        }
コード例 #3
0
        private void DoComplete()
        {
            CountHeaderEntity header = SelectedCountHeader;

            if (header == null)
            {
                MsgBox.Warn("请选中要完成的单据。");
                return;
            }

            if (header.BillState == BaseCodeConstant.COUNT_STATE_CLOSE)
            {
                MsgBox.Warn(string.Format("单据“{0}”盘点已完成。", header.BillID));
                return;
            }

            if (MsgBox.AskOK(string.Format("确认将单据”{0}“设置为完成状态吗?", header.BillID)) != DialogResult.OK)
            {
                return;
            }

            try
            {
                bool result = CompleteBill(header.BillID, GlobeSettings.LoginedUser.UserName);
                if (result)
                {
                    header.BillState = BaseCodeConstant.COUNT_STATE_CLOSE;
                    header.StateName = "已完成";
                    MsgBox.OK("单据成功设置为完成状态。");
                }

                //int result = CompleteBill(header.BillID, GlobeSettings.LoginedUser.UserName);
                //if (result == 1)
                //{
                //    header.BillState = BaseCodeConstant.COUNT_STATE_CLOSE;
                //    header.StateName = "已完成";
                //    MsgBox.OK("单据成功设置为完成状态。");
                //}
                //else if (result == -1)
                //    MsgBox.Warn("未找到该盘点单,可能已经被其他人删除,请刷新数据后重试。");
                //else if (result == -2)
                //    MsgBox.Warn("该盘点单已经完成,请刷新数据后重试。");
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
        }
コード例 #4
0
        private void DoRecount()
        {
            CountHeaderEntity header = SelectedCountHeader;

            if (header == null)
            {
                MsgBox.Warn("请选中要完成的单据。");
                return;
            }
            if (Convert.ToInt32(header.BillState) < Convert.ToInt32(BaseCodeConstant.COUNT_STATE_CLOSE))
            {
                MsgBox.Warn(string.Format("单据“{0}”还没盘点完成。", header.BillID));
                return;
            }
            List <LocationEntity> locations = ListGetLocations(header.BillID);

            FrmLocationConfirm frmConfirm = new FrmLocationConfirm(locations, "复盘");

            frmConfirm.ShowDialog();
            frmConfirm.Dispose();
        }
コード例 #5
0
        private void DoReportToERP()
        {
            CountHeaderEntity header = SelectedCountHeader;

            if (header == null)
            {
                MsgBox.Warn("请选中要查看的盘点单。");
                return;
            }

            //查看单据状态是否为完成,否则不允许进入
            CountHeaderEntity _header = GetBillInfo(header.BillID);

            if (_header == null || _header.BillState != BaseCodeConstant.COUNT_STATE_CLOSE)
            {
                MsgBox.Warn("必须是已经完成的盘点单才可以上传。");
                return;
            }

            FrmReportToERP frmReport = new FrmReportToERP(header.BillID);

            frmReport.ShowDialog();
        }
コード例 #6
0
        /// <summary>
        /// 盘点单管理---根据条件查询盘点单
        /// </summary>
        /// <param name="warehouse"></param>
        /// <param name="billNO"></param>
        /// <param name="billStatus"></param>
        /// <param name="showNotComplete"></param>
        /// <param name="dateFrom"></param>
        /// <param name="dateTo"></param>
        /// <returns></returns>
        public List <CountHeaderEntity> QueryBills(string warehouse, string billNO,
                                                   string billStatus, bool showNotComplete, DateTime?dateFrom, DateTime?dateTo)
        {
            List <CountHeaderEntity> list = new List <CountHeaderEntity>();

            try
            {
                #region 请求数据
                System.Text.StringBuilder loStr = new System.Text.StringBuilder();
                loStr.Append("warehouse=").Append(warehouse).Append("&");
                loStr.Append("billNO=").Append(billNO).Append("&");
                loStr.Append("billStatus=").Append(billStatus).Append("&");
                loStr.Append("showNotComplete=").Append(showNotComplete).Append("&");
                loStr.Append("dateFrom=").Append(dateFrom).Append("&");
                loStr.Append("dateTo=").Append(dateTo);
                string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_QueryBills_PanDian);
                if (string.IsNullOrEmpty(jsonQuery))
                {
                    MsgBox.Warn(WebWork.RESULT_NULL);
                    //LogHelper.InfoLog(WebWork.RESULT_NULL);
                    return(list);
                }
                #endregion

                #region 正常错误处理

                JsonQueryBillsPanDian bill = JsonConvert.DeserializeObject <JsonQueryBillsPanDian>(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 (JsonQueryBillsPanDianResult jbr in bill.result)
                {
                    CountHeaderEntity asnEntity = new CountHeaderEntity();
                    asnEntity.BillID    = Convert.ToInt32(jbr.billId);
                    asnEntity.BillState = jbr.billState;
                    asnEntity.Creator   = jbr.creator;
                    asnEntity.Remark    = jbr.remark;
                    asnEntity.StateName = jbr.itemDesc;
                    asnEntity.TagDesc   = jbr.tagDesc;
                    asnEntity.Warehouse = jbr.whCode;
                    try
                    {
                        //if (!string.IsNullOrEmpty(jbr.closeDate))
                        //    asnEntity.CloseDate = Convert.ToDateTime(jbr.closeDate);
                        //if (!string.IsNullOrEmpty(jbr.printedTime))
                        //    asnEntity.PrintedTime = Convert.ToDateTime(jbr.printedTime);
                        if (!string.IsNullOrEmpty(jbr.createDate))
                        {
                            asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate);
                        }
                    }
                    catch (Exception msg)
                    {
                        MsgBox.Warn(msg.Message);
                        //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg);
                    }
                    list.Add(asnEntity);
                }
                return(list);

                #endregion
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
            return(list);
        }
コード例 #7
0
        /// <summary>
        /// 盘点单管理---报告上传
        /// </summary>
        /// <param name="billID"></param>
        /// <returns></returns>
        public CountHeaderEntity GetBillInfo(int billID)
        {
            CountHeaderEntity asnEntity = new CountHeaderEntity();

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

                #region 正常错误处理

                JsonGetBillInfo bill = JsonConvert.DeserializeObject <JsonGetBillInfo>(jsonQuery);
                if (bill == null)
                {
                    MsgBox.Warn(WebWork.JSON_DATA_NULL);
                    return(asnEntity);
                }
                if (bill.flag != 0)
                {
                    MsgBox.Warn(bill.error);
                    return(asnEntity);
                }
                #endregion
                List <CountHeaderEntity> list = new List <CountHeaderEntity>();
                #region 赋值数据
                foreach (JsonGetBillInfoResult jbr in bill.result)
                {
                    asnEntity.BillID    = Convert.ToInt32(jbr.billId);
                    asnEntity.BillState = jbr.billState;
                    asnEntity.Creator   = jbr.creator;
                    asnEntity.Remark    = jbr.remark;
                    asnEntity.Warehouse = jbr.whCode;
                    try
                    {
                        if (!string.IsNullOrEmpty(jbr.createDate))
                        {
                            asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate);
                        }
                    }
                    catch (Exception msg)
                    {
                        MsgBox.Warn(msg.Message);
                        //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg);
                    }

                    try
                    {
                        if (!string.IsNullOrEmpty(jbr.completeDate))
                        {
                            asnEntity.CompleteDate = Convert.ToDateTime(jbr.completeDate);
                        }
                    }
                    catch (Exception msg)
                    {
                        MsgBox.Warn(msg.Message);
                        //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg);
                    }

                    list.Add(asnEntity);
                }
                return(asnEntity);

                #endregion
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
            return(asnEntity);
        }
コード例 #8
0
ファイル: FrmCountExecute.cs プロジェクト: uwitec/wms-1
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DataTable data = gridControl2.DataSource as DataTable;

            if (data == null)
            {
                return;
            }
            if (MsgBox.AskOK("是否提交差异表") != DialogResult.OK)
            {
                return;
            }

            try
            {
                using (WaitDialogForm tm = new WaitDialogForm("请稍等...", "正在执行库存调整"))
                {
                    #region
                    CountHeaderEntity header = listBillNO.GetSelectedDataRow() as CountHeaderEntity;
                    if (header == null)
                    {
                        MsgBox.Warn("盘点单无效!");
                        return;
                    }
                    if (!CycleCountStockExecute(header.BillID))
                    {
                        return;
                    }
                    else
                    {
                        MsgBox.OK("执行完成。");
                    }
                    #endregion
                }


                #region
                //int billId = -1;
                //foreach (DataRow row in data.Rows)
                //{
                //    billId = ConvertUtil.ToInt(row["BILL_ID"]);
                //    bool result = ExecuteStock(ConvertUtil.ToInt(row["ID"]), GlobeSettings.LoginedUser.WarehouseCode);
                //    if (!result)
                //    {
                //        MsgBox.Warn(string.Format("物料编码为{0}的物料未维护最小计量单位,请尽早维护!", ConvertUtil.ToString(row["SKU_CODE"])));
                //    }
                //    object[] array ={row["ID"],row["BILL_ID"],row["LC_CODE"],
                //                   row["ZN_NAME"],row["SKU_CODE"],row["UM_NAME"],
                //                   row["SKU_NAME"],row["SPEC"],row["COUNT_QTY"],
                //                   row["STOCK_QTY"],row["REMARK"],row["IS_EFFECT"]};
                //    Insert(ELogType.盘点, GlobeSettings.LoginedUser.UserName, ConvertUtil.ToString(billId), ConvertUtil.ToString(result), "盘点差异调整",
                //        DateTime.Now, JsonConvert.SerializeObject(array));
                //}

                ////更新单据状态
                //UpdateBillState(billId, "已执行调整");
                //frmWait.Close();
                //MsgBox.OK("执行完成。");
                //LoadData();
                #endregion
            }
            catch (Exception ex)
            {
                //frmWait.Close();
                MsgBox.Err(ex.Message);
            }
        }