Exemplo n.º 1
0
        /// <summary>
        /// 4.销售
        /// </summary>
        private void ManagerXS()
        {
            bool bolState = false;
            try
            {
                KPS.Model.XiaoShouInfo _Modelinfo = (KPS.Model.XiaoShouInfo)_control.GetSaveData();
                _Modelinfo.DataType = thisdeviceinfo.DeviceID;

                KPS.BLL.XiaoShouManager xiaoshoumanager = new XiaoShouManager();
                if (ModelData != null)
                {
                    _Modelinfo.ID = ((XiaoShouInfo)ModelData).ID;
                    bolState = xiaoshoumanager.Update(_Modelinfo);

                     ShowMsgStateInfo(bolState, ModelData);
                }
                else
                {
                    KPS.BLL.InventoryManager InventoryMg = new InventoryManager();
                    InventoryUpState _stateinfo= InventoryMg.Sell(_Modelinfo);
                    switch (_stateinfo)
                    {
                        case InventoryUpState.Succed:
                            bolState = xiaoshoumanager.Add(_Modelinfo);
                            ShowMsgStateInfo(bolState, ModelData);
                            break;
                        case InventoryUpState.ProductLacking:
                            MessageBox.Show("库存不足,无法新增销售记录!(可通过新增购进记录来增加库存)");
                            break;
                        case InventoryUpState.ProductNoExt:
                            MessageBox.Show("未找到符合条件的产品购进记录!(请核对 产品名称+生产厂家+注册证号+批号 是否正确)");
                            break;
                        case InventoryUpState.SysTemError:
                            MessageBox.Show("处理失败!");
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                ShowMsgStateInfo(bolState, ModelData);
                bolState = false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 3.2.4.删除诊断试剂销售记录
        /// </summary>
        /// <param name="_list"></param>
        /// <param name="strTpeName">类型名称</param>
        private void DelXS(System.Collections.IList _list, string strTpeName)
        {
            if (new ConfirmFrm("确认删除", string.Format("您确定需要删除所选的 {0} 条【{1}】记录?", _list.Count, strTpeName), "是", "否", 3).ShowDialog() == DialogResult.OK)
            {
                string strIDList = "";
                foreach (object _obj in _list)
                {
                    if (_obj is KPS.Model.XiaoShouInfo)
                    {
                        strIDList = strIDList + ((KPS.Model.XiaoShouInfo)_obj).ID + ",";
                    }
                }
                if (strIDList.Contains(","))
                {
                    strIDList = strIDList.Substring(0, strIDList.Length - 1);
                }

                if (strIDList.Length > 0)
                {
                    KPS.BLL.XiaoShouManager manager = new BLL.XiaoShouManager();
                    if (manager.DeleteList(strIDList))
                    {
                        MessageBox.Show("删除成功!");
                        this.RecordListView.RemoveObjects(_list);
                    }
                    else
                    {
                        MessageBox.Show("删除失败!");
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string strBeginTime = dateTimePicker1.Value.ToString("yyyy-MM-dd 00:00:00");
            string strEndTime = dateTimePicker2.Value.ToString("yyyy-MM-dd 23:59:59");
            string strProductName = txtProductName.Text.Trim();//去除空格,产品名称
            string strCGDWName = txtGYS.Text.Trim();//去除空格,采购单位
            string strSCSName = txtSCS.Text.Trim();//去除空格,生产/制造商

            string strWhereCondition = string.Format("(p_date>=#{0}# and p_date<=#{1}#)", strBeginTime, strEndTime);

            if (thisdevice != null && !string.IsNullOrEmpty(thisdevice.DeviceType))
            {
                strWhereCondition = strWhereCondition + string.Format(" and DataType={0}", thisdevice.DeviceID);
            }
            if (!string.IsNullOrEmpty(strSCSName))
            {
                strWhereCondition = strWhereCondition + string.Format(" and p_zzs like '%{0}%'", strSCSName);
            }
            if (!string.IsNullOrEmpty(strCGDWName))
            {
                strWhereCondition = strWhereCondition + string.Format(" and p_gys like '%{0}%'", strCGDWName);
            }
            if (!string.IsNullOrEmpty(strProductName))
            {
                strWhereCondition = strWhereCondition + string.Format(" and p_cpmc like '%{0}%'", strProductName);
            }

            XiaoShouManager manager = new XiaoShouManager();
            try
            {
                List<XiaoShouInfo> listData = manager.GetModelList(strWhereCondition);

                if (ListLoadingEvent != null)
                {
                    ListLoadingEvent(listData, true, "获取记录列表成功!");
                }
            }
            catch (Exception ex)
            {
                if (ListLoadingEvent != null)
                {
                    ListLoadingEvent(null,false,ex.Message);
                }
            }
        }