Ejemplo n.º 1
0
        private void BtnItemDel_Click(object sender, RoutedEventArgs e)
        {
            WmsAreaInfo m_WmsAreaInfo = tvMain.SelectedItem as WmsAreaInfo;

            if ((m_WmsAreaInfo == null) || (string.IsNullOrEmpty(m_WmsAreaInfo.PKNO)))
            {
                return;
            }
            //删除明细
            WmsAllocationInfo m_AllocationInfo = gridItem.SelectedItem as WmsAllocationInfo;

            if (m_AllocationInfo == null)
            {
                return;
            }

            if (System.Windows.Forms.MessageBox.Show($"确定删除货位信息【{m_AllocationInfo.ALLOCATION_NAME}】吗?",
                                                     @"删除信息",
                                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                m_AllocationInfo.USE_FLAG = -1;
                ws.UseService(s => s.UpdateWmsAllocationInfo(m_AllocationInfo));

                //删除成功.
                List <WmsAllocationInfo> mWmsAllocationInfos =
                    ws.UseService(s => s.GetWmsAllocationInfos($"AREA_PKNO = {m_WmsAreaInfo.PKNO} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.CREATION_DATE)
                    .ToList();
                gridItem.ItemsSource = mWmsAllocationInfos;

                BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
            }
        }
Ejemplo n.º 2
0
 public WmsAllocationInfo GetWmsAllocationInfoById(string Id)
 {
     using (IWmsAllocationInfoBLL WmsAllocationInfoBLL = BLLContainer.Resolve <IWmsAllocationInfoBLL>())
     {
         WmsAllocationInfo model = WmsAllocationInfoBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Ejemplo n.º 3
0
 public bool AddWmsAllocationInfo(WmsAllocationInfo mWmsAllocationInfo)
 {
     if (mWmsAllocationInfo == null)
     {
         return(false);
     }
     using (IWmsAllocationInfoBLL WmsAllocationInfoBLL = BLLContainer.Resolve <IWmsAllocationInfoBLL>())
     {
         return(WmsAllocationInfoBLL.Add(mWmsAllocationInfo));
     }
 }
Ejemplo n.º 4
0
 public bool DelWmsAllocationInfo(string Id)
 {
     using (IWmsAllocationInfoBLL WmsAllocationInfoBLL = BLLContainer.Resolve <IWmsAllocationInfoBLL>())
     {
         try
         {
             WmsAllocationInfo item = WmsAllocationInfoBLL.GetFirstOrDefault(Id);
             return(WmsAllocationInfoBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 5
0
        private void BtnItemSave_Click(object sender, RoutedEventArgs e)
        {
            WmsAreaInfo m_WmsAreaInfo = tvMain.SelectedItem as WmsAreaInfo;

            if ((m_WmsAreaInfo == null) || (string.IsNullOrEmpty(m_WmsAreaInfo.PKNO)))
            {
                return;
            }
            WmsAllocationInfo m_AllocationInfo = gbItem.DataContext as WmsAllocationInfo;

            if (m_AllocationInfo == null)
            {
                return;
            }

            #region  校验

            if (string.IsNullOrEmpty(m_AllocationInfo.ALLOCATION_NAME))
            {
                System.Windows.Forms.MessageBox.Show("请输入货位名称。", "保存", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #endregion

            if (string.IsNullOrEmpty(m_AllocationInfo.PKNO)) //新增
            {
                m_AllocationInfo.PKNO             = Guid.NewGuid().ToString("N");
                m_AllocationInfo.CREATED_BY       = CBaseData.LoginName;
                m_AllocationInfo.CREATION_DATE    = DateTime.Now;
                m_AllocationInfo.LAST_UPDATE_DATE = DateTime.Now;

                ws.UseService(s => s.AddWmsAllocationInfo(m_AllocationInfo));

                //重新刷新数据
                List <WmsAllocationInfo> mAllocationInfos =
                    ws.UseService(s => s.GetWmsAllocationInfos($"AREA_PKNO = {m_WmsAreaInfo.PKNO} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.CREATION_DATE)
                    .ToList();
                gridItem.ItemsSource = mAllocationInfos;
            }
            else  //修改
            {
                m_AllocationInfo.UPDATED_BY       = CBaseData.LoginName;
                m_AllocationInfo.LAST_UPDATE_DATE = DateTime.Now;
                ws.UseService(s => s.UpdateWmsAllocationInfo(m_AllocationInfo));
            }
            //提示保存成功

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Ejemplo n.º 6
0
 public bool DelWmsAllocationInfos(string[] Ids)
 {
     using (IWmsAllocationInfoBLL WmsAllocationInfoBLL = BLLContainer.Resolve <IWmsAllocationInfoBLL>())
     {
         try
         {
             List <WmsAllocationInfo> entitys = new List <WmsAllocationInfo>();
             foreach (string id in Ids)
             {
                 WmsAllocationInfo item = WmsAllocationInfoBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(WmsAllocationInfoBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 7
0
        private void BtnItemAdd_Click(object sender, RoutedEventArgs e)
        {
            WmsAreaInfo m_WmsAreaInfo = tvMain.SelectedItem as WmsAreaInfo;

            if ((m_WmsAreaInfo == null) || (string.IsNullOrEmpty(m_WmsAreaInfo.PKNO)))
            {
                return;
            }

            //添加明细
            dictBasic.Header   = "货位信息维护  【新增】";
            gbItem.IsCollapsed = false;
            gbItem.Visibility  = Visibility.Visible;

            WmsAllocationInfo m_AllocationInfos = new WmsAllocationInfo()
            {
                COMPANY_CODE     = "",
                AREA_PKNO        = m_WmsAreaInfo.PKNO,
                ALLOCATION_STATE = 0,
                USE_FLAG         = 1,
            };

            gbItem.DataContext = m_AllocationInfos;
        }
Ejemplo n.º 8
0
        private Action <int, int, string, string, int, string> _showAlloc; //显示界面信息

        private void RefreshAllocation()
        {
            #region 创建显示信息的函数,提高效率

            _showAlloc = (col, lay, allInfo, goodsNO, allocProportion, palletInfo) =>
            {
                //myShelf.RefreshAlloInfo(col, lay, allInfo, goodsNO, allocProportion, palletInfo);
            };

            #endregion

            WcfClient <IWMSService> wsWMS  = new WcfClient <IWMSService>();
            WcfClient <IRSMService> wsRsm1 = new WcfClient <IRSMService>();

            while (!CBaseData.AppClosing)
            {
                if (!bRefreshAllo)
                {
                    Thread.Sleep(500);
                    continue;
                }

                try
                {
                    //获取货位及库存状态
                    List <WmsAllocationInfo> allocations = wsWMS.UseService(s =>
                                                                            s.GetWmsAllocationInfos($"USE_FLAG = 1 AND AREA_PKNO = '{areaPKNO}'"));
                    List <WmsInventory> inventories = wsWMS.UseService(s => s.GetWmsInventorys($"AREA_PKNO = '{areaPKNO}'"));  //库存信息

                    for (int col = 1; col <= totalColumn; col++)
                    {
                        for (int lay = 1; lay <= totalLayer; lay++)
                        {
                            WmsAllocationInfo allocation =
                                allocations.FirstOrDefault(c => c.ALLOCATION_COL == col && c.ALLOCATION_LAY == lay);

                            var    col1           = col;
                            var    lay1           = lay;
                            string allInfo        = "";
                            string goodsNO        = "";
                            int    alloproportion = -1; //禁用
                            string palletInfo     = "";

                            if (allocation != null)
                            {
                                alloproportion = SafeConverter.SafeToInt(allocation.ALLOCATION_STATE);
                                palletInfo     = allocation.ALLOCATION_NAME;

                                var inv = inventories.FirstOrDefault(c => c.ALLOCATION_PKNO == allocation.PKNO);
                                if (inv != null)  //有库存
                                {
                                    goodsNO = inv.MATERIAL_PKNO;
                                    RsItemMaster item =
                                        wsRsm1.UseService(s => s.GetRsItemMasterById(inv.MATERIAL_PKNO));
                                    if (item != null)
                                    {
                                        allInfo = item.ITEM_NAME + " (" + inv.INVENTORY_NUM?.ToString("f0") + ")";
                                    }
                                }
                            }

                            //显示信息
                            Dispatcher.BeginInvoke(_showAlloc, col1, lay1, allInfo, goodsNO, alloproportion, palletInfo);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                Thread.Sleep(1000);
            }
        }