'批号新增
Dim qq As new QueryBuilder
qq.TableName = "MPSDiff2"
qq.Sel ectString = "Se lect OrderDate,批号,EndCustomer,CustomerPO,Pos,PartNo,OrderQty,ETD,ShippingTerms,ID,产品,数量,发货日期,发货方式,订单日期,{Orderlist}.Remark From {Orderlist} Left JOIN {myOrderlistBackup} ON {myOrderlistBackup}.[ID] = {Orderlist}.[批号] Where {myOrderlistBackup}.ID is null"
qq.Build
MainTable = Tables("MPSDiff2")
'批号删除
Dim qqq As new QueryBuilder
qqq.TableName = "MPSDiff3"
qqq.Se lectString = "Sel ect OrderDate,批号,EndCustomer,CustomerPO,Pos,PartNo,OrderQty,ETD,ShippingTerms,ID,产品,数量,发货日期,发货方式,订单日期,{Orderlist}.Remark From {Orderlist} Right JOIN {myOrderlistBackup} ON {myOrderlistBackup}.[ID] = {Orderlist}.[批号] Where {orderlist}.批号 is null"
qqq.Build
MainTable = Tables("MPSDiff3")
'Qty变更
Dim qqqq As new QueryBuilder
qqqq.TableName = "MPSDiff4"
qqqq.Se ectString = "Se lect OrderDate,批号,EndCustomer,CustomerPO,Pos,PartNo,OrderQty,ETD,ShippingTerms,ID,产品,数量,发货日期,发货方式,订单日期,{Orderlist}.Remark From {Orderlist} Inner JOIN {myOrderlistBackup} ON {myOrderlistBackup}.[ID] = {Orderlist}.[批号] Where {Orderlist}.orderQty <> {myOrderlistBackup}.数量"
qqqq.Build
MainTable = Tables("MPSDiff4")
'Shippingterms变更
Dim qqqqq As new QueryBuilder
qqqqq.TableName = "MPSDiff5"
qqqqq.Se lectString = "Se lect OrderDate,批号,EndCustomer,CustomerPO,Pos,PartNo,OrderQty,ETD,ShippingTerms,ID,产品,数量,发货日期,发货方式,订单日期,{Orderlist}.Remark From {Orderlist} Inner JOIN {myOrderlistBackup} ON {myOrderlistBackup}.[ID] = {Orderlist}.[批号] Where {Orderlist}.ShippingTerms <> {myOrderlistBackup}.发货方式"
qqqqq.Build
MainTable = Tables("MPSDiff5")
'Part No变更
Dim qqqqqq As new QueryBuilder
qqqqqq.TableName = "MPSDiff6"
qqqqqq.Se lectString = "Se lect OrderDate,批号,EndCustomer,CustomerPO,Pos,PartNo,OrderQty,ETD,ShippingTerms,ID,产品,数量,发货日期,发货方式,订单日期,{Orderlist}.Remark From {Orderlist} Inner JOIN {myOrderlistBackup} ON {myOrderlistBackup}.[ID] = {Orderlist}.[批号] Where {Orderlist}.partno <> {myOrderlistBackup}.产品"
qqqqqq.Build
MainTable = Tables("MPSDiff6")
'DataTables("MPSDiff").datarows.clear
'Dim dr2 As DataRow = DataTables("MyplanningDiff").AddNew()
DataTables("MyplanningDiff").datarows.clear
Dim f11 As New Filler
f11.SourceTable = DataTables("MPSDiff1") '指定数据来源
f11.DataTable = DataTables("MyplanningDiff") '指定数据接收表
f11.Fill() '填充数据
For Each ar As Row In Tables("MyplanningDiff").Rows
If ar("变更内容") = Nothing
ar("变更内容") = "ETD变更"
End If
Next
Dim f2 As New Filler
f2.SourceTable = DataTables("MPSDiff2") '指定数据来源
f2.DataTable = DataTables("MyplanningDiff") '指定数据接收表
f2.Fill() '填充数据
For Each ar As Row In Tables("MyplanningDiff").Rows
If ar("变更内容") = Nothing
ar("变更内容") = "批号新增"
End If
Next
Dim f3 As New Filler
f3.SourceTable = DataTables("MPSDiff3") '指定数据来源
f3.DataTable = DataTables("MyplanningDiff") '指定数据接收表
f3.Fill() '填充数据
For Each ar As Row In Tables("MyplanningDiff").Rows
If ar("变更内容") = Nothing
ar("变更内容") = "批号删除"
End If
Next
Dim f4 As New Filler
f4.SourceTable = DataTables("MPSDiff4") '指定数据来源
f4.DataTable = DataTables("MyplanningDiff") '指定数据接收表
f4.Fill() '填充数据
For Each ar As Row In Tables("MyplanningDiff").Rows
If ar("变更内容") = Nothing
ar("变更内容") = "Qty变更"
End If
Next
Dim f5 As New Filler
f5.SourceTable = DataTables("MPSDiff5") '指定数据来源
f5.DataTable = DataTables("MyplanningDiff") '指定数据接收表
f5.Fill() '填充数据
For Each ar As Row In Tables("MyplanningDiff").Rows
If ar("变更内容") = Nothing
ar("变更内容") = "发货方式变更"
End If
Next
Dim f6 As New Filler
f6.SourceTable = DataTables("MPSDiff6") '指定数据来源
f6.DataTable = DataTables("MyplanningDiff") '指定数据接收表
f6.Fill() '填充数据
For Each ar As Row In Tables("MyplanningDiff").Rows
If ar("变更内容") = Nothing
ar("变更内容") = "Part No变更"
End If
Next
DataTables("MyplanningDiff").save
Tables("MyplanningDiff").sort ="变更内容 desc"
If Tables("MyplanningDiff").value IsNot Nothing
Dim flg As New SaveExcelFlags
flg.RowNumber = True
flg.CellStyle = True
'Tables("MyplanningDiff").SaveExcel("d:\myPlanningDiff\myPlanningDiff " &format(Date.now,"yyyyMMddHHmmss") & ".xlsx","Diff",flg)
ShowAppWindow("myPlanningDiff.xls",5)
Tables("MyplanningDiff").SaveExcel(ProjectPath & "Attachments\myPlanningDiff.xls",format(Date.now,"yyyyMMddHHmmss") ,flg)
If ShowAppWindow("myPlanningDiff.xls",1) = False Then
Dim Proc As New Process
msgbox ("有变更内容产生!!!")
Proc.File = ProjectPath & "Attachments\myPlanningDiff.xls"
Proc.Start
End If