Пример #1
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            var username = textBoxUsername.Text;
            var password = textBoxPassword.Text;

            try
            {
                this.Enabled = false;
                AppUtil.EnsureNetworkConnected();
                if (string.IsNullOrEmpty(SysConfig.Current.ServerUrl))
                {
                    throw new Exception("请先设置服务器Url");
                }
                var serverVersion = RpcFacade.Call <string>("/MainSystem/B3Butchery/Rpcs/ClientRpc/GetPdaVersion");
                if (serverVersion != Util.Version)
                {
                    throw new Exception(string.Format("服务器版本[{0}]与当前客户端版本[{1}]不匹配", serverVersion, Util.Version));
                }

                RpcFacade.Login(username, password);
                mConfig.Username = username;
                mConfig.Password = password;
                Util.OnceLogined = true;

                //记录会计单位名称 和部门ID,Name
                mConfig.AccountingUnit_Name = RpcFacade.Call <string>("/MainSystem/B3Butchery/Rpcs/BaseInfoRpc/GetAccountUnitNameById", mConfig.AccountingUnit_ID ?? 0);
                RpcObject depart = RpcFacade.Call <RpcObject>("/MainSystem/B3Butchery/Rpcs/BaseInfoRpc/GetDepartmentBaseInfoDto");
                mConfig.Department_ID    = depart.Get <long>("ID");
                mConfig.Department_Name  = depart.Get <string>("Name");
                mConfig.Department_Depth = depart.Get <int?>("Department_Depth");
                mConfig.Save();

                this.Enabled = true;
                new MainForm().ShowDialog();
            }
            catch (Exception ex)
            {
                if (mConfig.Username == username && mConfig.Password == password)
                {
                    this.Enabled = true;
                    new MainForm().ShowDialog();
                }
                else
                {
                    MessageBox.Show("用户离线登录失败," + ex.Message);
                }
            }
            finally
            {
                this.Enabled = true;
            }
        }
Пример #2
0
        public static ClientGoods CreateClientGoods(RpcObject obj)
        {
            var goods = new ClientGoods();

            goods.Goods_ID         = obj.Get <long>("Goods_ID");
            goods.Goods_BarCode    = obj.Get <string>("Goods_Code");
            goods.Goods_Name       = obj.Get <string>("Goods_Name");
            goods.Goods_MainUnit   = obj.Get <string>("Goods_MainUnit");
            goods.Goods_SecondUnit = obj.Get <string>("Goods_SecondUnit");

            var d = obj.Get <NamedValue>("Goods_UnitConvertDirection");

            if (d != null)
            {
                if (d.Value == 0)
                {
                    goods.Goods_UnitConvertDirection = GoodsUnitConvertDirection.双向转换;
                }
                else if (d.Value == 1)
                {
                    goods.Goods_UnitConvertDirection = GoodsUnitConvertDirection.由主至辅;
                }
                else if (d.Value == 2)
                {
                    goods.Goods_UnitConvertDirection = GoodsUnitConvertDirection.由辅至主;
                }
            }

            goods.Goods_MainUnitRatio   = obj.Get <decimal?>("Goods_MainUnitRatio");
            goods.Goods_SecondUnitRatio = obj.Get <decimal?>("Goods_SecondUnitRatio");

            return(goods);
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <string> ids = new List <string>();

            try
            {
                foreach (ListViewItem item in listView1.Items)
                {
                    if (item.Checked)
                    {
                        var goods  = item.Tag as ClientGoods;
                        var number = decimal.Parse(item.SubItems[2].Text);

                        var dmo = new RpcObject("/MainSystem/B3Butchery/BO/FrozenInStore");

                        dmo.Set("AccountingUnit_ID", SysConfig.Current.AccountingUnit_ID);
                        dmo.Set("Department_ID", SysConfig.Current.Department_ID);
                        dmo.Set("Store_ID", mStoreId);
                        dmo.Set("ProductionPlan_ID", mProductPlanId);

                        var detail = new RpcObject("/MainSystem/B3Butchery/BO/FrozenInStore_Detail");
                        detail.Set("Goods_ID", goods.Goods_ID);
                        detail.Set("Number", number);

                        dmo.Get <ManyList>("Details").Add(detail);

                        long id = RpcFacade.Call <long>("/MainSystem/B3Butchery/Rpcs/FrozenInStoreRpc/PdaInsertAndCheck", dmo);
                        ids.Add(id.ToString());
                    }
                }
                if (ids.Any(x => x == "0"))
                {
                    MessageBox.Show("没有速冻入库新建权限");
                    return;
                }
                if (ids.Any(x => x == "-1"))
                {
                    MessageBox.Show("没有速冻入库审核权限");
                    return;
                }
                MessageBox.Show("生成速冻入库单:" + string.Join(",", ids.ToArray()));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                LoadGoodsFromRpc();
            }
        }