From 69a1b7107ca42ef46a42e98f7aadd3ea70fb35ed Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 20 十一月 2025 09:19:32 +0800
Subject: [PATCH] 不用再增加一个专门的序号,就按照这个编号,不是列表都有个编号嘛,好,那个送货单就显示就显示那个编号,比如说雷波中学,你在左送货单的左上角2是1或者。或者有三果十一都可以。
---
CY_ECommercePlatform/CY.WebForm/Pages/business/PlanOrderList.aspx.cs | 351 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 218 insertions(+), 133 deletions(-)
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/business/PlanOrderList.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/business/PlanOrderList.aspx.cs
index 0c3f059..4f03aa8 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/business/PlanOrderList.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/business/PlanOrderList.aspx.cs
@@ -29,6 +29,7 @@
//WorkBookTypeBLL _WorkBookTypeBLL = new WorkBookTypeBLL();
CoreCmsPlanOrderItemBLL _coreCmsPlanOrderItemBLL = new CoreCmsPlanOrderItemBLL();
EC_OrderPrintParameterBLL _OrderPrintParameterBLL = new EC_OrderPrintParameterBLL();
+ OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
public string orderkeyid = "";
protected void Page_Load(object sender, EventArgs e)
@@ -198,6 +199,7 @@
return;
}
var lie = new List<JiHuaOrder>();
+ var jiHuaOrderDetails = new List<JiHuaOrderDetail>();
using (var fileStream = file.InputStream)
{
// 浣跨敤HSSFWorkbook鎵撳紑.xls鏍煎紡鐨勬枃浠�
@@ -206,10 +208,41 @@
// 鑾峰彇绗竴涓伐浣滆〃
ISheet sheet = workbook.GetSheetAt(0);
- // 杩唬宸ヤ綔琛ㄤ腑鐨勬墍鏈夎
- for (int i = 1; i <= sheet.LastRowNum; i++)
+
+ //鑾峰彇琛ㄥご浣滀笟鏈悕绉�
+ for (int i = 0; i < 1; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ int j = 5;
+ while (true)
+ {
+ var jiHuaOrderDetail = new JiHuaOrderDetail();
+
+ ICell cell1 = row.GetCell(j);
+ if (cell1 == null)
+ {
+ break;
+ }
+ jiHuaOrderDetail.name = getcellvalue(cell1);
+ if (string.IsNullOrEmpty(jiHuaOrderDetail.name))
+ {
+ break;
+ }
+ j += 1;
+ jiHuaOrderDetails.Add(jiHuaOrderDetail);
+ }
+ }
+
+
+
+
+ // 杩唬宸ヤ綔琛ㄤ腑鐨勬墍鏈夎
+ for (int i = 1; i <= sheet.LastRowNum; i++)
{
var hang = new JiHuaOrder();
+ var jiHuaOrderDetails1 = new List<JiHuaOrderDetail>();
+
+
IRow row = sheet.GetRow(i);
if (row == null) continue; // 璺宠繃绌鸿
@@ -217,116 +250,95 @@
ICell cell0 = row.GetCell(0);
if (cell0 == null)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "甯備笉鑳戒负绌�", this);
+ JavaScript.MessageBox("绗�" + (i + 1) + "鐗囧尯涓嶈兘涓虹┖", this);
return;
}
- hang.shi = getcellvalue(cell0);
+ hang.pianqu = getcellvalue(cell0);
ICell cell1 = row.GetCell(1);
if (cell1 == null)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "鍖哄幙涓嶈兘涓虹┖", this);
+ JavaScript.MessageBox("绗�" + (i + 1) + "瀛︽牎涓嶈兘涓虹┖", this);
return;
}
- hang.quxian = getcellvalue(cell1);
+ hang.shipAddress = getcellvalue(cell1);
ICell cell2 = row.GetCell(2);
if (cell2 == null)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "鐗囧尯涓嶈兘涓虹┖", this);
+ JavaScript.MessageBox("绗�" + (i + 1) + "鑱旂郴浜轰笉鑳戒负绌�", this);
return;
}
- hang.pianqu = getcellvalue(cell2);
+ hang.shipName = getcellvalue(cell2);
ICell cell3 = row.GetCell(3);
if (cell3 == null)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "瀛︽牎涓嶈兘涓虹┖", this);
+ JavaScript.MessageBox("绗�" + (i + 1) + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖", this);
return;
}
- hang.shipAddress = getcellvalue(cell3);
+ hang.shipMobile = getcellvalue(cell3);
ICell cell4 = row.GetCell(4);
if (cell4 == null)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "鑱旂郴浜轰笉鑳戒负绌�", this);
- return;
- }
- hang.shipName = getcellvalue(cell4);
-
- ICell cell5 = row.GetCell(5);
- if (cell5 == null)
- {
- JavaScript.MessageBox("绗�" + (i + 1) + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖", this);
- return;
- }
- hang.shipMobile = getcellvalue(cell5);
-
- ICell cell6 = row.GetCell(6);
- if (cell6 == null)
- {
JavaScript.MessageBox("绗�" + (i + 1) + "鏀惰揣鍦板潃涓嶈兘涓虹┖", this);
return;
}
- hang.shouhuoAddress = getcellvalue(cell6);
+ hang.shouhuoAddress = getcellvalue(cell4);
- ICell cell7 = row.GetCell(7);
- if (cell7 == null)
+
+
+ for(int j=0; j< jiHuaOrderDetails.Count; j++)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖", this);
- return ;
- }
- hang.name = getcellvalue(cell7);
-
+ var jiHuaOrderDetail = new JiHuaOrderDetail();
- ICell cell8 = row.GetCell(8);
- if (cell8 == null)
- {
- JavaScript.MessageBox("绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖", this);
- return ;
- }
- hang.specification = getcellvalue(cell8);
-
+ jiHuaOrderDetail.name = jiHuaOrderDetails[j].name;
- //ICell cell9 = row.GetCell(9);
- //if (cell9 == null)
+ ICell cell9 = row.GetCell(j+5);
+ if (cell9 == null)
+ {
+ JavaScript.MessageBox("绗�" + (i + 1) + "鏁伴噺涓嶈兘涓虹┖", this);
+ return;
+ }
+ int aaa = 0;
+ int.TryParse(getcellvalue(cell9), out aaa);
+ jiHuaOrderDetail.nums = aaa;
+
+ jiHuaOrderDetails1.Add(jiHuaOrderDetail);
+ }
+
+
+
+ //ICell cell7 = row.GetCell(7);
+ //if (cell7 == null)
//{
- // JavaScript.MessageBox("绗�" + (i + 1) + "鍗曚环锛堝厓锛変笉鑳戒负绌�", this);
+ // JavaScript.MessageBox("绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖", this);
// return ;
//}
- //hang.price = decimal.Parse(getcellvalue(cell9));
+ //hang.name = getcellvalue(cell7);
- ICell cell9 = row.GetCell(9);
- if (cell9 == null)
- {
- JavaScript.MessageBox("绗�" + (i + 1) + "鏁伴噺涓嶈兘涓虹┖", this);
- return ;
- }
- int aaa = 0;
- int.TryParse(getcellvalue(cell9), out aaa);
- hang.nums = aaa;
+ //ICell cell8 = row.GetCell(8);
+ //if (cell8 == null)
+ //{
+ // JavaScript.MessageBox("绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖", this);
+ // return ;
+ //}
+ //hang.specification = getcellvalue(cell8);
+
+
+
+
+
+ hang.jiHuaOrderDetails = jiHuaOrderDetails1;
lie.Add(hang);
}
}
-
-
if (lie != null && lie.Count > 0)
{
- if (string.IsNullOrEmpty(lie[0].shi))
- {
- JavaScript.MessageBox("绗�" + 1 + "甯備笉鑳戒负绌�", this);
- return;
- }
- if (string.IsNullOrEmpty(lie[0].quxian))
- {
- JavaScript.MessageBox("绗�" + 1 + "鍖哄幙涓嶈兘涓虹┖", this);
- return;
- }
-
-
for (int i = 0; i < lie.Count; i++)
{
if (!string.IsNullOrEmpty(lie[i].shipAddress))
@@ -337,26 +349,88 @@
return;
}
-
+
}
- if (string.IsNullOrEmpty(lie[i].name))
+
+ for(int j = 0;j< lie[i].jiHuaOrderDetails.Count; j++)
{
- JavaScript.MessageBox("绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖", this);
- return;
+ if (string.IsNullOrEmpty(lie[i].jiHuaOrderDetails[j].name))
+ {
+ JavaScript.MessageBox("绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖", this);
+ return;
+ }
}
- if (string.IsNullOrEmpty(lie[i].specification))
- {
- JavaScript.MessageBox("绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖", this);
- return;
- }
+
+
+
+ //if (string.IsNullOrEmpty(lie[i].specification))
+ //{
+ // JavaScript.MessageBox("绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖", this);
+ // return;
+ //}
}
}
+
+
+
+
+
+
+
+
+
+
var orderid = HideKeyid.Value;
var sys_CitySites = bll_Sys_CitySiteBLL.SelectAllModel(null).ToList();
var eC_OrderPrintParameter = _OrderPrintParameterBLL.GetModel(orderid.ToInt32().Value); ;
InquiryCommonModel model = SerializationHelper.DeSerialize(typeof(InquiryCommonModel), eC_OrderPrintParameter.PrintParameter) as InquiryCommonModel;
+
+
+ var eC_OrderBasic = _eC_OrderBasicBLL.SelectModelById(orderid.ToInt32().Value);
+ var Province = "";
+ var City = "";
+ var County = "";
+ int Provinceid = 0;
+ int Cityid = 0;
+ int Countyid = 0;
+ if (eC_OrderBasic != null)
+ {
+
+ var customerCommunications = bll_OA_CorporateClientsBLL.GetModel_CustomerCommunications(eC_OrderBasic.BuyerId);
+ Province = customerCommunications.Province;
+ City = customerCommunications.City;
+ County = customerCommunications.County;
+
+ var sys_CitySite = bll_Sys_CitySiteBLL.GetModelByName(Province);
+ if (sys_CitySite != null)
+ {
+ Provinceid = sys_CitySite.Keyid;
+ var sys_CitySite1 = bll_Sys_CitySiteBLL.SelectAllNextModel(sys_CitySite.Keyid, 0, 2).FirstOrDefault(x => x.Name == City);
+ if (sys_CitySite1 != null)
+ {
+ Cityid = sys_CitySite1.Keyid;
+ var sys_CitySite2 = bll_Sys_CitySiteBLL.SelectAllNextModel(sys_CitySite.Keyid, sys_CitySite1.Keyid, 3).FirstOrDefault(x => x.Name == County);
+ if (sys_CitySite2 != null)
+ {
+ Countyid = sys_CitySite2.Keyid;
+ }
+ }
+ }
+ }
+
+ var Bianhao = _PlanOrderBLL.GetModelByorderid(HideKeyid.Value.ToInt32().Value).Max(x => x.Bianhao);
+
+ if (Bianhao.HasValue && Bianhao.Value > 0)
+ {
+ Bianhao = Bianhao.Value + 1;
+ }
+ else
+ {
+ Bianhao = 1;
+ }
+
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
new TransactionOptions
@@ -370,72 +444,83 @@
string pianqu = "";
if (lie != null && lie.Count > 0)
{
- var order = new List<JiHuaOrder>();
- for (int i = 0; i < lie.Count; i++)
+
+ for (int j = 0; j < lie.Count; j++)
{
- if (i == 0)
+ var coreCmsPlanOrder = _PlanOrderBLL.GetModelByorderid(HideKeyid.Value.ToInt32().Value).Where(x => x.shipAddress == lie[j].shipAddress && x.shouhuoAddress == lie[j].shouhuoAddress).FirstOrDefault();
+ if (coreCmsPlanOrder == null)
{
+ CoreCmsPlanOrder order = new CoreCmsPlanOrder();
+ order.Bianhao = Bianhao;
+ order.status = 1;
+ order.shipMobile = lie[j].shipMobile;
+ order.shipAddress = lie[j].shipAddress;
+ order.shipName = lie[j].shipName;
+ order.shouhuoAddress = lie[j].shouhuoAddress;
+ order.userMobile = lie[j].shipMobile;
+ order.createBy = CurrentUser.ShortName;
+ order.createTime = DateTime.Now;
+ order.upDataBy = CurrentUser.ShortName;
+ order.upDataTime = DateTime.Now;
+ order.isdelete = false;
+ order.orderkeyid = HideKeyid.Value.ToInt32();
+ order.FirmId = CurrentUser.MemberId;
+ order.sheng = Province;
+ order.shi = City;
+ order.quxian = County;
+ order.shengId = Provinceid;
+ order.shiId = Cityid;
+ order.quxianId = Countyid;
- order.Add(lie[i]);
- pianqu = lie[i].pianqu;
- }
- else
- {
- if (string.IsNullOrEmpty(lie[i].shipAddress))
+ order.pianqu = lie[j].pianqu;
+
+ var jiHuaOrders = lie[j].jiHuaOrderDetails;
+ decimal orderAmount = 0;
+ var cmsPlanOrderItems = new List<CoreCmsPlanOrderItem>();
+ for (int i = 0; i < jiHuaOrders.Count; i++)
{
- order.Add(lie[i]);
- }
- else
- {
- //淇濆瓨璁㈠崟
- //jm = await _coreCmsPlanOrderServices.ToAddJiHua(order, _user.ID, _user.Name);
- //if (jm.code == 1)
- //{
- // return jm;
- //}
- string res = saveorder(order,model.InquiryWorkBookList,sys_CitySites);
- if (!string.IsNullOrEmpty(res))
+ var workbook = model.InquiryWorkBookList.FirstOrDefault(x => (x.WorkBookSizeTxt + x.WorkBookNameTxt ) == jiHuaOrders[i].name || (x.WorkBookNameTxt + x.WorkBookSizeTxt ) == jiHuaOrders[i].name);
+ if (workbook == null)
{
- JavaScript.MessageBox(res, this);
+ JavaScript.MessageBox(jiHuaOrders[i].name + "娌℃壘鍒板崟浠�", this);
return;
}
- order = new List<JiHuaOrder>();
- if (string.IsNullOrEmpty(lie[i].shi))
- {
- lie[i].shi = lie[0].shi;
- }
- if (string.IsNullOrEmpty(lie[i].quxian))
- {
- lie[i].quxian = lie[0].quxian;
- }
- if (string.IsNullOrEmpty(lie[i].pianqu))
- {
- lie[i].pianqu = pianqu;
- }
- else
- {
- pianqu = lie[i].pianqu;
- }
- order.Add(lie[i]);
+ var item = new CoreCmsPlanOrderItem();
+ item.orderId = 0;
+ item.name = workbook.WorkBookNameTxt;
+ item.specification = workbook.WorkBookSizeTxt;
+ item.price = workbook.WorkBookPrice.ToDecimal2().Value;//jiHuaOrders[i].price;
+ item.fengmian = string.IsNullOrEmpty(workbook.fengmian) ? "" : workbook.fengmian;
+ item.neiye = string.IsNullOrEmpty(workbook.neiye) ? "" : workbook.neiye;
+ item.nums = jiHuaOrders[i].nums; ;
+ item.amount = item.price * (decimal)jiHuaOrders[i].nums;
+ item.createBy = CurrentUser.ShortName;
+ item.createTime = DateTime.Now;
+ item.upDataBy = CurrentUser.ShortName;
+ item.upDataTime = DateTime.Now;
+ item.isdelete = false;
+ item.isOld = true;
+ cmsPlanOrderItems.Add(item);
+ orderAmount += item.amount;
+ }
+
+ order.orderAmount = orderAmount;
+ order.oldOrderAmount = orderAmount;
+ order.keYongAmount = 0;
+ order.huaFeiAmount = 0;
+
+
+ var id = _PlanOrderBLL.InsertModelIden(order);
+ Bianhao = Bianhao + 1;
+ var ssss = false;
+ foreach (var cmsPlanOrderItem in cmsPlanOrderItems)
+ {
+ cmsPlanOrderItem.orderId = id;
+ ssss = _PlanOrderBLL.insertModelOrderItem(cmsPlanOrderItem);
}
}
- if (i == lie.Count - 1)
- {
- //淇濆瓨璁㈠崟
- //jm = await _coreCmsPlanOrderServices.ToAddJiHua(order, _user.ID, _user.Name);
- //if (jm.code == 1)
- //{
- // return jm;
- //}
- string res = saveorder(order, model.InquiryWorkBookList, sys_CitySites);
- if (!string.IsNullOrEmpty(res))
- {
- JavaScript.MessageBox(res, this);
- return;
- }
- }
}
--
Gitblit v1.9.1