|
|
@@ -61,7 +61,7 @@ namespace FrmStandAloneMetering
|
|
|
private bool blThreadFlag;//数据采集线程开关
|
|
|
private StringBuilder weightLog = new StringBuilder(); //重量日志的文件
|
|
|
|
|
|
- private MeterWorkCarActFirAlonService alonService = new MeterWorkCarActFirAlonService();
|
|
|
+ private MeterWorkCarActualFirstService actualFirstService = new MeterWorkCarActualFirstService();
|
|
|
|
|
|
public FrmStandAloneMetering()
|
|
|
{
|
|
|
@@ -86,6 +86,32 @@ namespace FrmStandAloneMetering
|
|
|
string[] strParams = strComPara.Split(new char[] { ',' });
|
|
|
cbChooseCom.Text = strParams[0];
|
|
|
}
|
|
|
+
|
|
|
+ //物料下拉框赋值
|
|
|
+ DataTable dtMatterInfo = selectMatterInfo();
|
|
|
+ this.cbMatterName.DataSource = dtMatterInfo;
|
|
|
+ this.cbMatterName.DisplayMember = "name";
|
|
|
+ this.cbMatterName.ValueMember = "value";
|
|
|
+
|
|
|
+ //发货单位下拉框赋值
|
|
|
+ DataTable dtForwardingUnit = selectCustomerInfo();
|
|
|
+ this.cbForwardingUnitName.DataSource = dtForwardingUnit;
|
|
|
+ this.cbForwardingUnitName.DisplayMember = "name";
|
|
|
+ this.cbForwardingUnitName.ValueMember = "value";
|
|
|
+
|
|
|
+ //收货单位下拉框赋值
|
|
|
+ DataTable dtReceivingUint = selectCustomerInfo();
|
|
|
+ this.cbReceivingUintName.DataSource = dtReceivingUint;
|
|
|
+ this.cbReceivingUintName.DisplayMember = "name";
|
|
|
+ this.cbReceivingUintName.ValueMember = "value";
|
|
|
+
|
|
|
+ //计量点下拉框赋值
|
|
|
+ DataTable dtSpotInfo = selectSpotInfo();
|
|
|
+ this.cbBaseSpot.DataSource = dtSpotInfo;
|
|
|
+ this.cbBaseSpot.DisplayMember = "name";
|
|
|
+ this.cbBaseSpot.ValueMember = "value";
|
|
|
+
|
|
|
+
|
|
|
//界面稳定时间赋值
|
|
|
cbStableSchedule.Text = stableTime.ToString();
|
|
|
|
|
|
@@ -130,7 +156,6 @@ namespace FrmStandAloneMetering
|
|
|
private void btnDownloadData_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
|
|
|
-
|
|
|
// 删除CSV文件
|
|
|
Utils.FileUtil.DeleteFile(AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseMatterInfo.csv");
|
|
|
|
|
|
@@ -158,6 +183,19 @@ namespace FrmStandAloneMetering
|
|
|
|
|
|
// 重新保存CSV文件
|
|
|
saveCustomerInfo(rmx2);
|
|
|
+
|
|
|
+ // 删除CSV文件
|
|
|
+ Utils.FileUtil.DeleteFile(AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseSpotInfo.csv");
|
|
|
+
|
|
|
+ // 获取客商信息
|
|
|
+ MeterBaseSpotInfoService service3 = new MeterBaseSpotInfoService();//物料服务
|
|
|
+ MeterBaseSpotInfo customerInfo2 = new MeterBaseSpotInfo();
|
|
|
+
|
|
|
+ customerInfo2.validFlag = "1";
|
|
|
+ RESTfulResult<List<MeterBaseSpotInfo>> rmx3 = service3.doQueryWf(customerInfo2);
|
|
|
+
|
|
|
+ // 重新保存CSV文件
|
|
|
+ saveSpotInfo(rmx3);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -392,17 +430,17 @@ namespace FrmStandAloneMetering
|
|
|
MeterWorkCarActualFirst actualFirst = new MeterWorkCarActualFirst(); //一次计量实体
|
|
|
actualFirst.actualFirstNo = "CAR" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); //主键
|
|
|
actualFirst.carNo = tbCarNo.Text.Trim();//车号
|
|
|
- actualFirst.baseSpotName = cbBaseSpot.Text.Trim();//计量点
|
|
|
- actualFirst.meterTypeName = cbMeterTypeName.Text.Trim();//业务类型
|
|
|
- actualFirst.contractNo = cbContractNo.Text.Trim();//合同号
|
|
|
- actualFirst.batchNo = tbBatchNo.Text.Trim();//批次号
|
|
|
- actualFirst.heatNo = tbHeatNo.Text.Trim();//炉号
|
|
|
- actualFirst.shipmentNum = Convert.ToInt32(string.IsNullOrEmpty(tbShipmentNum.Text.Trim()) ? "0" : tbShipmentNum.Text.Trim());//包数/数量
|
|
|
- actualFirst.matterName = cbMatterName.Text.Trim();//物资名称
|
|
|
- actualFirst.receivingUintName = cbReceivingUintName.Text.Trim();//收货单位
|
|
|
- actualFirst.forwardingUnitName = cbForwardingUnitName.Text.Trim();//发货单位
|
|
|
- actualFirst.customerSupplierName = cbCustomerSupplierName.Text.Trim();//供应商
|
|
|
- actualFirst.loadPointName = cbLoadPointName.Text.Trim();//卸货地点
|
|
|
+ actualFirst.baseSpotNo = cbBaseSpot.SelectedValue.ToString().Trim();//计量点
|
|
|
+ //actualFirst.meterTypeName = cbMeterTypeName.Text.Trim();//业务类型
|
|
|
+ //actualFirst.contractNo = cbContractNo.Text.Trim();//合同号
|
|
|
+ //actualFirst.batchNo = tbBatchNo.Text.Trim();//批次号
|
|
|
+ //actualFirst.heatNo = tbHeatNo.Text.Trim();//炉号
|
|
|
+ //actualFirst.shipmentNum = Convert.ToInt32(string.IsNullOrEmpty(tbShipmentNum.Text.Trim()) ? "0" : tbShipmentNum.Text.Trim());//包数/数量
|
|
|
+ actualFirst.matterNo = cbMatterName.SelectedValue.ToString().Trim();//物资名称
|
|
|
+ actualFirst.receivingUintNo = cbReceivingUintName.SelectedValue.ToString().Trim();//收货单位
|
|
|
+ actualFirst.forwardingUnitNo = cbForwardingUnitName.SelectedValue.ToString().Trim();//发货单位
|
|
|
+ //actualFirst.customerSupplierName = cbCustomerSupplierName.Text.Trim();//供应商
|
|
|
+ //actualFirst.loadPointName = cbLoadPointName.Text.Trim();//卸货地点
|
|
|
actualFirst.memo = tbMemo.Text.Trim();//备注
|
|
|
actualFirst.weightType = strWeightType;//重量类型
|
|
|
actualFirst.meterWeight = ucStorageWeightT1.getWgt() * 1000;
|
|
|
@@ -415,17 +453,17 @@ namespace FrmStandAloneMetering
|
|
|
actualFirstLogHead.Append("createTime,");//若第一行默认为当前时间则第一行多个逗号
|
|
|
actualFirstLogHead.Append("actualFirstNo,");
|
|
|
actualFirstLogHead.Append("carNo,");
|
|
|
- actualFirstLogHead.Append("baseSpotName,");
|
|
|
- actualFirstLogHead.Append("meterTypeName,");
|
|
|
- actualFirstLogHead.Append("contractNo,");
|
|
|
- actualFirstLogHead.Append("batchNo,");
|
|
|
- actualFirstLogHead.Append("heatNo,");
|
|
|
- actualFirstLogHead.Append("shipmentNum,");
|
|
|
- actualFirstLogHead.Append("matterName,");
|
|
|
- actualFirstLogHead.Append("receivingUintName,");
|
|
|
- actualFirstLogHead.Append("forwardingUnitName,");
|
|
|
- actualFirstLogHead.Append("customerSupplierName,");
|
|
|
- actualFirstLogHead.Append("loadPointName,");
|
|
|
+ actualFirstLogHead.Append("baseSpotNo,");
|
|
|
+ //actualFirstLogHead.Append("meterTypeName,");
|
|
|
+ //actualFirstLogHead.Append("contractNo,");
|
|
|
+ //actualFirstLogHead.Append("batchNo,");
|
|
|
+ //actualFirstLogHead.Append("heatNo,");
|
|
|
+ //actualFirstLogHead.Append("shipmentNum,");
|
|
|
+ actualFirstLogHead.Append("matterNo,");
|
|
|
+ actualFirstLogHead.Append("receivingUintNo,");
|
|
|
+ actualFirstLogHead.Append("forwardingUnitNo,");
|
|
|
+ //actualFirstLogHead.Append("customerSupplierName,");
|
|
|
+ //actualFirstLogHead.Append("loadPointName,");
|
|
|
actualFirstLogHead.Append("memo,");
|
|
|
actualFirstLogHead.Append("weightType,"); //最后一行不要逗号
|
|
|
actualFirstLogHead.Append("meterWeight");
|
|
|
@@ -436,17 +474,17 @@ namespace FrmStandAloneMetering
|
|
|
actualFirstLog.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",");
|
|
|
actualFirstLog.Append(actualFirst.actualFirstNo.ToString() + ",");
|
|
|
actualFirstLog.Append(actualFirst.carNo.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.baseSpotName.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.meterTypeName.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.contractNo.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.batchNo.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.heatNo.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.shipmentNum.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.matterName.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.receivingUintName.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.forwardingUnitName.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.customerSupplierName.ToString() + ",");
|
|
|
- actualFirstLog.Append(actualFirst.loadPointName.ToString() + ",");
|
|
|
+ actualFirstLog.Append(actualFirst.baseSpotNo.ToString() + ",");
|
|
|
+ // actualFirstLog.Append(actualFirst.meterTypeName.ToString() + ",");
|
|
|
+ //actualFirstLog.Append(actualFirst.contractNo.ToString() + ",");
|
|
|
+ //actualFirstLog.Append(actualFirst.batchNo.ToString() + ",");
|
|
|
+ //actualFirstLog.Append(actualFirst.heatNo.ToString() + ",");
|
|
|
+ //actualFirstLog.Append(actualFirst.shipmentNum.ToString() + ",");
|
|
|
+ actualFirstLog.Append(actualFirst.matterNo.ToString() + ",");
|
|
|
+ actualFirstLog.Append(actualFirst.receivingUintNo.ToString() + ",");
|
|
|
+ actualFirstLog.Append(actualFirst.forwardingUnitNo.ToString() + ",");
|
|
|
+ //actualFirstLog.Append(actualFirst.customerSupplierName.ToString() + ",");
|
|
|
+ //actualFirstLog.Append(actualFirst.loadPointName.ToString() + ",");
|
|
|
actualFirstLog.Append(actualFirst.memo.ToString() + ",");
|
|
|
actualFirstLog.Append(actualFirst.weightType.ToString() + ",");
|
|
|
actualFirstLog.Append(actualFirst.meterWeight.ToString());
|
|
|
@@ -470,13 +508,14 @@ namespace FrmStandAloneMetering
|
|
|
int rowCount = csvDataTable.Rows.Count;
|
|
|
if (csvDataTable != null && csvDataTable.Rows.Count > 0)
|
|
|
{
|
|
|
- List<MeterWorkCarActFirAlon> lp = csvDataTable.TableToDataList<MeterWorkCarActFirAlon>();
|
|
|
+ List<MeterWorkCarActualFirst> lp = csvDataTable.TableToDataList<MeterWorkCarActualFirst>();
|
|
|
DialogResult dr = MessageBox.Show("共 " + lp.Count + " 条计量数据,是否继续上传?", "提示", MessageBoxButtons.OKCancel);
|
|
|
if (dr != DialogResult.OK)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- RESTfulResult<string> rES = alonService.batchInsertAlonData(lp);
|
|
|
+ //操作日志
|
|
|
+ RESTfulResult<string> rES = actualFirstService.addEmergency(lp);
|
|
|
if (rES.Succeed)
|
|
|
{
|
|
|
MessageBox.Show("数据上传成功!");
|
|
|
@@ -644,6 +683,10 @@ namespace FrmStandAloneMetering
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 保存物料信息到csv文件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="result"></param>
|
|
|
private void saveMatterInfo(RESTfulResult<List<MeterBaseMatterInfo>> result)
|
|
|
{
|
|
|
StringBuilder materInfoHead = new StringBuilder(); // 物料头
|
|
|
@@ -669,6 +712,10 @@ namespace FrmStandAloneMetering
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 保存收发货单位信息到csv文件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="result"></param>
|
|
|
private void saveCustomerInfo(RESTfulResult<List<MeterBaseCustomerSupplier>> result)
|
|
|
{
|
|
|
StringBuilder customerInfoHead = new StringBuilder(); // 客商头
|
|
|
@@ -696,5 +743,148 @@ namespace FrmStandAloneMetering
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 保存计量点信息到csv文件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="result"></param>
|
|
|
+ private void saveSpotInfo(RESTfulResult<List<MeterBaseSpotInfo>> result)
|
|
|
+ {
|
|
|
+ StringBuilder spotInfoHead = new StringBuilder(); // 客商头
|
|
|
+ spotInfoHead.Append("spotNo,");//若第一行默认为当前时间则第一行多个逗号
|
|
|
+ spotInfoHead.Append("spotName");
|
|
|
+
|
|
|
+ logCsv.WriteBaseData("MeterBaseSpotInfo", spotInfoHead.ToString());
|
|
|
+
|
|
|
+ if (result.Succeed)
|
|
|
+ {
|
|
|
+ StringBuilder spotInfo = new StringBuilder(); // 物料体
|
|
|
+
|
|
|
+ List<MeterBaseSpotInfo> list = result.Data;
|
|
|
+
|
|
|
+ if (result.Data != null)
|
|
|
+ {
|
|
|
+ foreach (MeterBaseSpotInfo info in list)
|
|
|
+ {
|
|
|
+ spotInfo.Clear();
|
|
|
+ spotInfo.Append(info.baseSpotNo + ",");
|
|
|
+ spotInfo.Append(info.baseSpotName + ",");
|
|
|
+
|
|
|
+ logCsv.WriteBaseData("MeterBaseSpotInfo", spotInfo.ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从csv文件读取物料信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private DataTable selectMatterInfo()
|
|
|
+ {
|
|
|
+ if (System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "baseData") == true
|
|
|
+ && System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseMatterInfo.csv") == true)
|
|
|
+ {
|
|
|
+ string path = AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseMatterInfo.csv";
|
|
|
+ DataTable csvDataTable = OpenCSV(path);
|
|
|
+ int rowCount = csvDataTable.Rows.Count;
|
|
|
+ if (csvDataTable != null && csvDataTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DataTable newCsvDataTable = new DataTable();
|
|
|
+ newCsvDataTable.Columns.Add("name");
|
|
|
+ newCsvDataTable.Columns.Add("value");
|
|
|
+ for (int i = 1; i < csvDataTable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow dr = newCsvDataTable.NewRow();
|
|
|
+ dr[0] = "[" + csvDataTable.Rows[i]["matterNo"].ToString() + "]" + csvDataTable.Rows[i]["matterName"].ToString();
|
|
|
+ dr[1] = csvDataTable.Rows[i]["matterNo"].ToString();
|
|
|
+ newCsvDataTable.Rows.Add(dr);
|
|
|
+ }
|
|
|
+ return newCsvDataTable;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从csv文件读取收发货单位信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private DataTable selectCustomerInfo()
|
|
|
+ {
|
|
|
+ if (System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "baseData") == true
|
|
|
+ && System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseCustomerSupplier.csv") == true)
|
|
|
+ {
|
|
|
+ string path = AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseCustomerSupplier.csv";
|
|
|
+ DataTable csvDataTable = OpenCSV(path);
|
|
|
+ int rowCount = csvDataTable.Rows.Count;
|
|
|
+ if (csvDataTable != null && csvDataTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DataTable newCsvDataTable = new DataTable();
|
|
|
+ newCsvDataTable.Columns.Add("name");
|
|
|
+ newCsvDataTable.Columns.Add("value");
|
|
|
+ for (int i = 1; i < csvDataTable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow dr = newCsvDataTable.NewRow();
|
|
|
+ dr[0] = "[" + csvDataTable.Rows[i]["customerSupplierNo"].ToString() + "]" + csvDataTable.Rows[i]["customerSupplierName"].ToString();
|
|
|
+ dr[1] = csvDataTable.Rows[i]["customerSupplierNo"].ToString();
|
|
|
+ newCsvDataTable.Rows.Add(dr);
|
|
|
+ }
|
|
|
+ return newCsvDataTable;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从csv文件读取计量点信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private DataTable selectSpotInfo()
|
|
|
+ {
|
|
|
+ if (System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "baseData") == true
|
|
|
+ && System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseSpotInfo.csv") == true)
|
|
|
+ {
|
|
|
+ string path = AppDomain.CurrentDomain.BaseDirectory + "baseData\\MeterBaseSpotInfo.csv";
|
|
|
+ DataTable csvDataTable = OpenCSV(path);
|
|
|
+ int rowCount = csvDataTable.Rows.Count;
|
|
|
+ if (csvDataTable != null && csvDataTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ DataTable newCsvDataTable = new DataTable();
|
|
|
+ newCsvDataTable.Columns.Add("name");
|
|
|
+ newCsvDataTable.Columns.Add("value");
|
|
|
+ for (int i = 1; i < csvDataTable.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow dr = newCsvDataTable.NewRow();
|
|
|
+ dr[0] = "[" + csvDataTable.Rows[i]["spotNo"].ToString() + "]" + csvDataTable.Rows[i]["spotName"].ToString();
|
|
|
+ dr[1] = csvDataTable.Rows[i]["spotNo"].ToString();
|
|
|
+ newCsvDataTable.Rows.Add(dr);
|
|
|
+ }
|
|
|
+ return newCsvDataTable;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|