Browse Source

完善

master
wugang 8 years ago
parent
commit
68cb26f358
7 changed files with 223 additions and 141 deletions
  1. +0
    -1
      BO/BO/LocalSyncBase.cs
  2. +2
    -1
      BO/LocalDmoSession.cs
  3. +48
    -0
      SegmentationInStore/Rpc/Dto/SegmentationInStoreExceptionRecord.cs
  4. +1
    -0
      SegmentationInStore/SegmentationInStore.csproj
  5. +74
    -68
      SegmentationInStore/SegmentationInStoreForm.Designer.cs
  6. +78
    -55
      SegmentationInStore/SegmentationInStoreForm.cs
  7. +20
    -16
      SegmentationWeight/SegmentationWeightForm.cs

+ 0
- 1
BO/BO/LocalSyncBase.cs View File

@ -57,7 +57,6 @@ namespace BO.BO
public DateTime? DeleteTime { get; set; }
protected DateTime mCreateTime=DateTime.Now;
/// <summary>
/// 每条记录都要记录创建时间
/// </summary>


+ 2
- 1
BO/LocalDmoSession.cs View File

@ -118,6 +118,7 @@ namespace BO
/// <param name="id"></param>
public static void SaveDelete<T>(long id) where T : LocalSyncBase
{
//
var updateDom = new DQUpdateDom(typeof(T));
updateDom.Where.Conditions.Add(DQCondition.EQ("ID", id));
updateDom.Columns.Add(new DQUpdateColumn("IsDeleted", true));
@ -255,7 +256,7 @@ namespace BO
else
{
//如果已同步
if (t.WillBeDeleted)
if (t.WillBeDeleted||t.IsDeleted)
{
//如果要删除


+ 48
- 0
SegmentationInStore/Rpc/Dto/SegmentationInStoreExceptionRecord.cs View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
namespace SegmentationInStore.Rpc.Dto
{
[Serializable]
[MapToTable("SegmentationInStoreExceptionRecord")]
[DFClass]
[KeyField("ID", KeyGenType.identity)]
public class SegmentationInStoreExceptionRecord
{
public SegmentationInStoreExceptionRecord(string barcode, string error)
{
BarCode = barcode;
ExceptionStr = error;
}
public long ID { get; set; }
protected DateTime mCreateTime = DateTime.Now;
/// <summary>
/// 每条记录都要记录创建时间
/// </summary>
public DateTime CreateTime
{
get { return mCreateTime; }
set { mCreateTime = value; }
}
public string BarCode { get; set; }
public string ExceptionStr { get; set; }
public override string ToString()
{
return BarCode + " " + ExceptionStr;
}
}
}

+ 1
- 0
SegmentationInStore/SegmentationInStore.csproj View File

@ -62,6 +62,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Rpc\Dto\SegmentationInStoreExceptionRecord.cs" />
<Compile Include="Rpc\Dto\SegmentationInStoreRecordDto.cs" />
<Compile Include="Rpc\Dto\SegmentationWeightRecordDto.cs" />
<Compile Include="Rpc\Dto\Ext.cs" />


+ 74
- 68
SegmentationInStore/SegmentationInStoreForm.Designer.cs View File

@ -36,11 +36,11 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
@ -66,14 +66,14 @@
this.submited日期 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.uDataGridView1 = new BWP.WinFormControl.UDataGridView();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.gridUnScan = new BWP.WinFormControl.UDataGridView();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.gridUnScan = new BWP.WinFormControl.UDataGridView();
this.unscan序号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.unscan条码 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.unscan产品 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -250,7 +250,7 @@
this.splitContainer2.Panel2.Controls.Add(this.groupBox2);
this.splitContainer2.Panel2.Controls.Add(this.groupBox1);
this.splitContainer2.Size = new System.Drawing.Size(1098, 488);
this.splitContainer2.SplitterDistance = 578;
this.splitContainer2.SplitterDistance = 603;
this.splitContainer2.TabIndex = 0;
//
// groupBox3
@ -261,7 +261,7 @@
this.groupBox3.Controls.Add(this.gridSubmited);
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(572, 482);
this.groupBox3.Size = new System.Drawing.Size(597, 482);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "已扫码产品";
@ -302,7 +302,7 @@
this.gridSubmited.RowsDefaultCellStyle = dataGridViewCellStyle5;
this.gridSubmited.RowTemplate.Height = 23;
this.gridSubmited.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.gridSubmited.Size = new System.Drawing.Size(566, 462);
this.gridSubmited.Size = new System.Drawing.Size(591, 462);
this.gridSubmited.TabIndex = 1;
//
// submited序号
@ -368,7 +368,7 @@
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Location = new System.Drawing.Point(7, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(506, 181);
this.groupBox2.Size = new System.Drawing.Size(481, 181);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "退库";
@ -409,52 +409,9 @@
this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.uDataGridView1.RowTemplate.Height = 23;
this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView1.Size = new System.Drawing.Size(503, 126);
this.uDataGridView1.Size = new System.Drawing.Size(478, 126);
this.uDataGridView1.TabIndex = 3;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "ID";
this.dataGridViewTextBoxColumn1.HeaderText = "序号";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
this.dataGridViewTextBoxColumn1.ReadOnly = true;
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn2.DataPropertyName = "BarCode";
this.dataGridViewTextBoxColumn2.HeaderText = "条码";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.dataGridViewTextBoxColumn3.DataPropertyName = "Goods_Name";
this.dataGridViewTextBoxColumn3.HeaderText = "产品";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
this.dataGridViewTextBoxColumn3.Width = 60;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "JingWeight";
dataGridViewCellStyle8.Format = "N2";
this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle8;
this.dataGridViewTextBoxColumn4.HeaderText = "重量";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.ReadOnly = true;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "CreateTime";
dataGridViewCellStyle9.Format = "F";
dataGridViewCellStyle9.NullValue = null;
this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle9;
this.dataGridViewTextBoxColumn5.HeaderText = "日期";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.ReadOnly = true;
//
// button2
//
this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -473,7 +430,7 @@
this.groupBox1.Controls.Add(this.gridUnScan);
this.groupBox1.Location = new System.Drawing.Point(7, 190);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(509, 295);
this.groupBox1.Size = new System.Drawing.Size(484, 295);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "未扫码产品";
@ -513,23 +470,71 @@
this.gridUnScan.RowsDefaultCellStyle = dataGridViewCellStyle15;
this.gridUnScan.RowTemplate.Height = 23;
this.gridUnScan.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.gridUnScan.Size = new System.Drawing.Size(503, 275);
this.gridUnScan.Size = new System.Drawing.Size(478, 275);
this.gridUnScan.TabIndex = 0;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "ID";
this.dataGridViewTextBoxColumn1.HeaderText = "序号";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
this.dataGridViewTextBoxColumn1.ReadOnly = true;
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.dataGridViewTextBoxColumn2.DataPropertyName = "BarCode";
this.dataGridViewTextBoxColumn2.HeaderText = "条码";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true;
this.dataGridViewTextBoxColumn2.Width = 65;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.dataGridViewTextBoxColumn3.DataPropertyName = "Goods_Name";
this.dataGridViewTextBoxColumn3.HeaderText = "产品";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
this.dataGridViewTextBoxColumn3.Width = 65;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "JingWeight";
dataGridViewCellStyle8.Format = "N2";
this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle8;
this.dataGridViewTextBoxColumn4.HeaderText = "重量";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.ReadOnly = true;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "CreateTime";
dataGridViewCellStyle9.Format = "F";
dataGridViewCellStyle9.NullValue = null;
this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle9;
this.dataGridViewTextBoxColumn5.HeaderText = "日期";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.ReadOnly = true;
this.dataGridViewTextBoxColumn5.Visible = false;
//
// unscan序号
//
this.unscan序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.unscan序号.DataPropertyName = "ID";
this.unscan序号.HeaderText = "序号";
this.unscan序号.Name = "unscan序号";
this.unscan序号.ReadOnly = true;
this.unscan序号.Width = 65;
//
// unscan条码
//
this.unscan条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.unscan条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.unscan条码.DataPropertyName = "BarCode";
this.unscan条码.HeaderText = "条码";
this.unscan条码.Name = "unscan条码";
this.unscan条码.ReadOnly = true;
this.unscan条码.Width = 65;
//
// unscan产品
//
@ -538,11 +543,11 @@
this.unscan产品.HeaderText = "产品";
this.unscan产品.Name = "unscan产品";
this.unscan产品.ReadOnly = true;
this.unscan产品.Width = 60;
this.unscan产品.Width = 65;
//
// unscan重量
//
this.unscan重量.DataPropertyName = "JingWeight";
this.unscan重量.DataPropertyName = "Weight";
dataGridViewCellStyle13.Format = "N2";
this.unscan重量.DefaultCellStyle = dataGridViewCellStyle13;
this.unscan重量.HeaderText = "重量";
@ -558,6 +563,7 @@
this.unscan日期.HeaderText = "日期";
this.unscan日期.Name = "unscan日期";
this.unscan日期.ReadOnly = true;
this.unscan日期.Visible = false;
//
// SegmentationInStoreForm
//
@ -607,11 +613,6 @@
private System.Windows.Forms.GroupBox groupBox4;
private BWP.WinFormControl.UDataGridView gridUnScan;
private BWP.WinFormControl.UDataGridView gridSubmited;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan序号;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan条码;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan产品;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan重量;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan日期;
private System.Windows.Forms.PictureBox picNetStatus;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.PictureBox picSyncStatus;
@ -622,11 +623,6 @@
private System.Windows.Forms.Button button2;
private System.Windows.Forms.GroupBox groupBox2;
private BWP.WinFormControl.UDataGridView uDataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
private System.Windows.Forms.ComboBox cbxStore;
private System.Windows.Forms.DataGridViewTextBoxColumn submited序号;
private System.Windows.Forms.DataGridViewTextBoxColumn submited条码;
@ -634,5 +630,15 @@
private System.Windows.Forms.DataGridViewTextBoxColumn submited重量;
private System.Windows.Forms.DataGridViewTextBoxColumn submited仓库;
private System.Windows.Forms.DataGridViewTextBoxColumn submited日期;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan序号;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan条码;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan产品;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan重量;
private System.Windows.Forms.DataGridViewTextBoxColumn unscan日期;
}
}

+ 78
- 55
SegmentationInStore/SegmentationInStoreForm.cs View File

@ -32,9 +32,9 @@ namespace SegmentationInStore
private BindingList<SegmentationInStoreRecord> mRecordList;
private readonly Thread _tdSyncLocalToMiddleDb;
private readonly Thread _tcCheckNetStatus;
private readonly Thread _tcCheckSyncStatus;
private readonly Thread _tdCheckNetStatus;
private readonly Thread _tdCheckSyncStatus;
private readonly Thread _tdGetUnScanRecords;
// BardCodeHooK BarCode = new BardCodeHooK();
public SegmentationInStoreForm()
@ -56,13 +56,17 @@ namespace SegmentationInStore
{
_tdSyncLocalToMiddleDb.Abort();
}
if (_tcCheckNetStatus != null && _tcCheckNetStatus.IsAlive)
if (_tdCheckNetStatus != null && _tdCheckNetStatus.IsAlive)
{
_tdCheckNetStatus.Abort();
}
if (_tdCheckSyncStatus != null && _tdCheckSyncStatus.IsAlive)
{
_tcCheckNetStatus.Abort();
_tdCheckSyncStatus.Abort();
}
if (_tcCheckSyncStatus != null && _tcCheckSyncStatus.IsAlive)
if (_tdGetUnScanRecords != null && _tdGetUnScanRecords.IsAlive)
{
_tcCheckSyncStatus.Abort();
_tdGetUnScanRecords.Abort();
}
};
@ -70,11 +74,36 @@ namespace SegmentationInStore
_tdSyncLocalToMiddleDb = new Thread(SyncLocalToMiddleDb);
_tdSyncLocalToMiddleDb.Start();
_tcCheckNetStatus = new Thread(CheckNetStatus);
_tcCheckNetStatus.Start();
_tdCheckNetStatus = new Thread(CheckNetStatus);
_tdCheckNetStatus.Start();
_tdCheckSyncStatus = new Thread(CheckSyncStatus);
_tdCheckSyncStatus.Start();
_tcCheckSyncStatus = new Thread(CheckSyncStatus);
_tcCheckSyncStatus.Start();
_tdGetUnScanRecords = new Thread(GetUnScanRecords);
_tdGetUnScanRecords.Start();
}
private void GetUnScanRecords()
{
while (true)
{
var listStr = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/GetNotInStoreList");
var list = JsonConvert.DeserializeObject<List<SegmentationWeightRecordDto>>(listStr);
this.Invoke(new Action(() =>
{
mUnScanList.Clear();
foreach (SegmentationWeightRecordDto dto in list)
{
mUnScanList.Insert(0, dto);
}
gridUnScan.DataSource = mUnScanList;
}
));
Thread.Sleep(1000);
}
}
private void CheckSyncStatus()
@ -163,6 +192,7 @@ namespace SegmentationInStore
}
}
private void InitCombox()
{
if (LoginRpcUtil.TestConnection(500))
@ -225,40 +255,25 @@ namespace SegmentationInStore
}
}
}
// private void doInsertUnSubmit(string barCode)
// {
// var fd = mUnScanList.FirstOrDefault(x => x.BarCode == barCode);
// if (fd == null)
// {
// //todo 放到错误信息里
// }
// mUnScanList.Remove(fd);
// var inStoreDto = fd.EToSegmentationInStore();
// inStoreDto.Store_ID = 0;
// inStoreDto.Store_Name = "仓库";
// mUnSubmitList.Insert(0, inStoreDto);
// BindUnSubmitGrid();
// }
void BindUnScanGrid()
{
lock (lockOjbUnScan)
{
gridUnScan.DataSource = mUnScanList;
}
}
void BindSubmitedGrid()
void AddException(string barcode,string error)
{
lock (lockOjbSubmited)
this.Invoke(new Action(() =>
{
gridSubmited.DataSource = mRecordList;
}
var errException = new SegmentationInStoreExceptionRecord(barcode, error);
using (var session = LocalDmoSession.New())
{
session.Insert(errException);
session.Commit();
}
richTextBox1.AppendText(errException.ToString() + Environment.NewLine);
}));
}
private void SegmentationInStoreForm_Load(object sender, EventArgs e)
{
@ -347,7 +362,7 @@ namespace SegmentationInStore
if (!LoginRpcUtil.TestConnection(1000))
{
MessageBox.Show("扫汇总码必须在线");
//todo 记录异常
AddException(barCodesBarCode, "扫汇总码必须在线");
return;
}
//添加多条记录
@ -357,8 +372,9 @@ namespace SegmentationInStore
if (list.Count < 1)
{
MessageBox.Show("没有查询到该汇总码");
AddException(barCodesBarCode, "没有查询到该汇总码");
return;
//todo 记录异常
}
foreach (SegmentationInStoreRecord dmo in list)
{
@ -394,8 +410,8 @@ namespace SegmentationInStore
if (string.IsNullOrWhiteSpace(code))
{
MessageBox.Show("条码错误"+ barCodesBarCode);
//todo
MessageBox.Show("条码错误:"+ barCodesBarCode);
AddException(barCodesBarCode, "条码错误");
return;
}
var bg = new BackgroundWorker();
@ -468,7 +484,7 @@ namespace SegmentationInStore
var isExist = IsExist(code);
if (isExist)
{
//todo 重复扫码
AddException(code, "重复扫码");
return record;
}
else
@ -478,15 +494,22 @@ namespace SegmentationInStore
SetStoreInfo(record);
if (LoginRpcUtil.TestConnection(1000))
{
var weightStr = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc/GetWeightRecord", code);
var weight = JsonConvert.DeserializeObject<SegmentationWeightRecordDto>(weightStr);
record.Goods_ID = weight.Goods_ID;
record.Goods_Name = weight.Goods_Name;
record.Goods_Spec = weight.Goods_Spec;
record.Weight = weight.Weight;
record.ProductBatch = weight.ProductBatch;
record.BiaoShi = weight.BiaoShi;
record.CardBarCode = weight.CardBarCode;
try
{
var weightStr = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc/GetWeightRecord", code);
var weight = JsonConvert.DeserializeObject<SegmentationWeightRecordDto>(weightStr);
record.Goods_ID = weight.Goods_ID;
record.Goods_Name = weight.Goods_Name;
record.Goods_Spec = weight.Goods_Spec;
record.Weight = weight.Weight;
record.ProductBatch = weight.ProductBatch;
record.BiaoShi = weight.BiaoShi;
record.CardBarCode = weight.CardBarCode;
}
catch (Exception e)
{
AddException(code, e.Message);
}
}
else
{
@ -506,7 +529,7 @@ namespace SegmentationInStore
var isExist = IsExist(dmo.BarCode);
if (isExist)
{
//todo 重复扫码
AddException(dmo.BarCode, "重复扫码");
return record;
}
else


+ 20
- 16
SegmentationWeight/SegmentationWeightForm.cs View File

@ -292,7 +292,7 @@ namespace SegmentationWeight
#region weightNeed
void OpenSerialPort()
{
if (_enableWeight)
if (!_enableWeight)
return;
if (SegmentationWeightContext.Config.RateSet == null)
throw new Exception("请先配置称相关信息");
@ -481,19 +481,7 @@ namespace SegmentationWeight
weightPort.Close();
}
public void enableWeight_Click(object sender, EventArgs e)
{
if (!_enableWeight)
{
OpenSerialPort();
_mainProcessIsRun = true;
ReadData();
}
else
{
DisableWeight();
}
}
#endregion
private void btnGoodsSet_Click(object sender, EventArgs e)
@ -839,13 +827,21 @@ namespace SegmentationWeight
{
btnEnableWeight.Text = "停止称重";
btnEnableWeight.BackColor = Color.ForestGreen;
OpenSerialPort();
_mainProcessIsRun = true;
ReadData();
}
else
{
btnEnableWeight.Text = "开始称重";
btnEnableWeight.BackColor = SystemColors.Control;
btnEnablePrint.UseVisualStyleBackColor = true;
DisableWeight();
}
}
private bool _enablePrint = false;
@ -893,9 +889,13 @@ namespace SegmentationWeight
if (record != null)
{
LocalDmoSession.SaveDelete<SegmentationWeightRecord>(record.ID);
uDataGridView1.Rows.Remove(row);
uDataGridView1.Refresh();
uDataGridView1.CurrentCell = null;
mAllWeightRecords.Remove(record);
mWeightRecords.Remove(record);
}
}
}
@ -912,8 +912,12 @@ namespace SegmentationWeight
{
if (SegmentationWeightRecordRpc.GetInstance().IsSyncSucessed())
{
var sucess=RpcFacade.Call<bool>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/CreateTodayB3OutputBill" );
if(sucess)
var id=RpcFacade.Call<long>("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/CreateTodayB3OutputBill" );
if(id>0)
{
MessageBox.Show("同步完成,创建产出单:"+id);
}
else if (id == -1)
{
MessageBox.Show("同步完成");
}


Loading…
Cancel
Save