You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DSWMS/DB/SQL_banben/17 仓储项目_仓储费变化日志.sql

1286 lines
110 KiB
Transact-SQL

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

CREATE TABLE [dbo].[OP_WMS_BASE](
[WMSBASEID] [uniqueidentifier] NOT NULL,
[BSNO] [varchar](50) NULL,
[BILLTYPE] [varchar](50) NULL,
[REMARK] [varchar](50) NULL,
[CORPID] [varchar](50) NULL,
[CreateID] [uniqueidentifier] NULL,
[Creator] [varchar](50) NULL,
[CreateDate] [datetime] NULL,
[CUSTOMERNAME] [varchar](50) NULL,
[MATERIALNO] [varchar](50) NULL,
[GOODSCODE] [varchar](50) NULL,
[GOODSNAME] [varchar](50) NULL,
[GOODSHSCODE] [varchar](50) NULL,
[MBLNO] [varchar](50) NULL,
[CNTRNO] [varchar](50) NULL,
[KGS] [numeric](18, 3) NULL,
[CBM] [numeric](18, 3) NULL,
[PKGS] [numeric](18, 3) NULL,
[KINDPKGS] [varchar](50) NULL,
[STORAGEUNIT] [varchar](50) NULL,
[STORAGEUNITCOUNT] [numeric](22, 6) NULL,
[RULEUNIT] [varchar](50) NULL,
[RULEUNITCOUNT] [numeric](18, 3) NULL,
[FEEENDDATE] [datetime] NULL,
[FEESTARTDATE] [datetime] NULL,
[INDATE] [datetime] NULL,
[STORAGEUNITCOUNT_SINGLE] [numeric](22, 6) NULL,
[RULEUNITCOUNT_SINGLE] [numeric](18, 3) NULL,
[OP] [uniqueidentifier] NULL,
[NETWEIGHT] [decimal](18, 3) NULL,
[CUSTOMNO] [varchar](50) NULL,
[ACCBOOKNO] [varchar](50) NULL,
[GOODSOWNER] [varchar](50) NULL,
[FEERATESTARTDATE] [datetime] NULL,
[WMSINDATE] [datetime] NULL,
[ARCLIENTWMSOUT] [varchar](50) NULL,
[COUNTRY] [varchar](100) NULL,
CONSTRAINT [PK_OP_WMS_BASE] PRIMARY KEY CLUSTERED
(
[WMSBASEID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
alter table OP_WMS add WMSBASEID [uniqueidentifier] null
GO
alter table OP_WMS add APCLIENTWMSOUT [varchar](50) NULL
GO
alter table OP_WMS_IN_PLAN add APCLIENTWMSOUT [varchar](50) NULL
GO
alter table OP_WMS_IN_DO add APCLIENTWMSOUT [varchar](50) NULL
GO
ALTER VIEW [dbo].[Vw_Op_Wms] AS select [WMSID]
,[BSNO]
,[BILLTYPE]
,[REMARK]
,[CORPID]
,[ModifyID]
,[Modifier]
,[ModifyDate]
,[CreateID]
,[Creator]
,[CreateDate]
,[CUSTOMERNAME]
,[MATERIALNO]
,[GOODSCODE]
,[GOODSNAME]
,[GOODSHSCODE]
,[MBLNO]
,[CNTRNO]
,[KGS]
,NETWEIGHT
,[CBM]
,[PKGS]
,[KINDPKGS]
,[STORAGEUNIT]
,[STORAGEUNITCOUNT]
,[RULEUNIT]
,[RULEUNITCOUNT]
,[ISCLEAR]
,[BSSTATUS]
,[FEESTATUS]
,[INDATE]
,[FEESTARTDATE]
,[FEEENDDATE]
,[FEERATESTARTDATE]
,[WMSINDATE]
,KGS_SINGLE,CBM_SINGLE,STORAGEUNITCOUNT_SINGLE,RULEUNITCOUNT_SINGLE,OP,CUSTOMNO,ACCBOOKNO,GOODSOWNER
,ARCLIENTWMSOUT,WMSBASEID
from OP_WMS
GO
ALTER PROCEDURE [dbo].[proc_isClientRepeat]
@oldGID VarChar(36),
@oldCODENAME VarChar(20),
@oldSHORTNAME VarChar(20),
@oldDESCRIPTION VarChar(50),
@newGID VarChar(36),
@newCODENAME VarChar(20),
@newSHORTNAME VarChar(20),
@newDESCRIPTION VarChar(50),
@strUserID VarChar(36),
@strUserName VarChar(150)
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRANSACTION--<2D><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
DECLARE @errorSun INT --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET @errorSun=0 --û<><C3BB>Ϊ0
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ԥ<EFBFBD><D4A4><EFBFBD>ձ<EFBFBD> ί<>е<EFBFBD>λ
UPDATE [crm_seaeorder] SET [CUSTOMERNAME] = @newSHORTNAME WHERE [CUSTOMERNAME] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ԥ<EFBFBD><D4A4><EFBFBD>ձ<EFBFBD> <20><><EFBFBD><EFBFBD>˾
UPDATE [crm_seaeorder] SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ԥ<EFBFBD><D4A4><EFBFBD>ձ<EFBFBD> <20><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>
UPDATE [crm_seaeorder] SET FORWARDER = @newSHORTNAME WHERE FORWARDER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ԥ<EFBFBD><D4A4><EFBFBD>ձ<EFBFBD> <20><>վ
UPDATE [crm_seaeorder] SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_seae SET [CUSTOMERNAME] = @newSHORTNAME WHERE [CUSTOMERNAME] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><>վ
UPDATE op_seae SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>˾
UPDATE op_seae SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>
UPDATE op_seae SET FORWARDER = @newSHORTNAME WHERE FORWARDER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_seae SET CUSTOMSER = @newSHORTNAME WHERE CUSTOMSER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_seae SET TRUCKER = @newSHORTNAME WHERE TRUCKER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_seae SET AGENTID= @newSHORTNAME WHERE AGENTID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20>ֿ<EFBFBD>
UPDATE op_seae SET WAREHOUSE= @newSHORTNAME WHERE WAREHOUSE = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B5A5>Ϣ <20><>վ
UPDATE op_seae_billmanage SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--ҵ<>񺯵<EFBFBD><F1BAAFB5><EFBFBD>Ϣ<EFBFBD><CFA2> TO<54><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λȫ<CEBB>ƣ<EFBFBD>
UPDATE op_letter SET HEAD_TO = @newDESCRIPTION WHERE HEAD_TO = @oldDESCRIPTION --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--ҵ<>񺯵<EFBFBD><F1BAAFB5><EFBFBD><EFBFBD><EFBFBD>֪ͨ<CDA8><D6AA>Ϣ<EFBFBD><CFA2> <20><><EFBFBD>䳡վ
UPDATE op_letter_yard SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--ҵ<>񺯵<EFBFBD><F1BAAFB5><EFBFBD><EFBFBD><EFBFBD>֪ͨ<CDA8><D6AA>Ϣ<EFBFBD><CFA2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ
UPDATE op_letter_yard SET YARD2 = @newSHORTNAME WHERE YARD2 = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--ҵ<>񺯵<EFBFBD><F1BAAFB5>ɳ<EFBFBD>֪ͨ<CDA8><D6AA>Ϣ<EFBFBD><CFA2> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_letter_truck SET TRUCK = @newSHORTNAME WHERE TRUCK = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--ҵ<>񺯵<EFBFBD><F1BAAFB5>ɳ<EFBFBD>֪ͨ<CDA8><D6AA>Ϣ<EFBFBD><CFA2> <20><><EFBFBD>䳡վ
UPDATE op_letter_truck SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--ҵ<>񺯵<EFBFBD><F1BAAFB5>ɳ<EFBFBD>֪ͨ<CDA8><D6AA>Ϣ<EFBFBD><CFA2> <20><><EFBFBD>䳡վ
UPDATE op_letter_truck SET RETURNYARD = @newSHORTNAME WHERE RETURNYARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ĭ<>ϳ<EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>
UPDATE code_voyno SET YARDID = @newSHORTNAME WHERE YARDID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ı<DEB8> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_modify SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ᵥǩ<E1B5A5><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ݹ<EFBFBD>˾
UPDATE op_blissue SET EXPRESSCORP = @newSHORTNAME WHERE EXPRESSCORP = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD>ö<EFBFBD><C3B6>˱<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_dui SET CUSTNAME = @newSHORTNAME WHERE CUSTNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--Ԥ<><D4A4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_fee_advance_payment SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--Ԥ<><D4A4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_fee_advance_payment_detail SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--Ԥ<><D4A4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_fee_agentdc SET AGENT = @newSHORTNAME WHERE AGENT = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>˱<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE CH_FEE_AutoDui SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_fee_settlement SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_fee_do SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE ch_fee_payapplication SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_invoiceapplication SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><>Ʊ<EFBFBD><C6B1> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_invoice SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD>շ<EFBFBD><D5B7>ñ<EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE crm_orderfee SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_hexiao SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_jinzhang SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_Mbody SET CUSTOMERSIDE = @newSHORTNAME WHERE CUSTOMERSIDE = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE ch_fee_recvapplication SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--֧Ʊ<D6A7><C6B1>Ϣ<EFBFBD><CFA2> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE ch_fee_cheque SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2> <20><><EFBFBD>㵥λ<E3B5A5><CEBB><EFBFBD><EFBFBD>
UPDATE code_fee_templatedetail SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ͻ<EFBFBD><CDBB>˼۲<CBBC>ѯ<EFBFBD><D1AF>־<EFBFBD><D6BE> <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE crm_price_carrier_log SET CREATEUSER = @newSHORTNAME WHERE CREATEUSER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
-------------------------------------------------
--<2D>ͻ<EFBFBD><CDBB><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ<EFBFBD>ӱ<EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>id
UPDATE info_client_contact SET LINKID = @newGID WHERE LINKID = @oldGID --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣά<CFA2><CEAC><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>id
UPDATE info_shipper SET codename = @newCODENAME WHERE codename = @oldCODENAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--CRM<52><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>id
UPDATE info_client SET ISSTOP=1,MODIFIEDUSER=@strUserID,MODIFIEDTIME=getdate() WHERE GID = @oldGID --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
INSERT INTO [sys_log]([NAME],[LOGTYPE],[LOGTIME],[LOGCONTENT],[CREATEUSER])
VALUES('<EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ϲ<EFBFBD>','UPDATE <20><><EFBFBD>²<EFBFBD><C2B2><EFBFBD>',getdate(),@strUserName+' <20><> '+@oldSHORTNAME+' ͬ '+@newSHORTNAME+' <20>ϲ<EFBFBD> ',@strUserID)
-------------------------------------------------
--<2D>ӿ<EFBFBD> cw_vouitems<6D><73> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>CUSTOMERNAME
UPDATE cw_vouitems SET [CUSTOMERNAME] = @newSHORTNAME WHERE [CUSTOMERNAME] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
-------------------------------------------------
--<2D><><EFBFBD><EFBFBD>cw_vouitems_gl<67><6C> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>ACCALL
UPDATE cw_vouitems_gl SET [ACCALL] = replace(ACCALL,@oldSHORTNAME,@newSHORTNAME) WHERE [ACCALL] like ('%'+@oldSHORTNAME+'%') --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>cw_vouitems_gl<67><6C> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>CUSTOMERNAME
UPDATE cw_vouitems_gl SET [CUSTOMERNAME] = @newSHORTNAME WHERE [CUSTOMERNAME] like ('%'+@oldSHORTNAME+'%') --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>cw_genleg_accitems<6D><73> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>CORPACC
--UPDATE cw_genleg_accitems SET [CORPACC] = @newSHORTNAME WHERE [CORPACC] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
--SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>cw_genleg_accitems<6D><73> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>CORPACC
UPDATE cw_genleg_accitems SET [AMTYEARDR]=[AMTYEARDR]+ISNULL((SELECT sum([AMTYEARDR]) as [AMTYEARDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTYEARCR]=[AMTYEARCR]+ISNULL((SELECT sum([AMTYEARCR]) as [AMTYEARCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTYEARBLC]=[AMTYEARBLC]+ISNULL((SELECT sum([AMTYEARBLC]) as [AMTYEARBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTDR]=[AMTDR]+ISNULL((SELECT sum([AMTDR]) as [AMTDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTCR]=[AMTCR]+ISNULL((SELECT sum([AMTCR]) as [AMTCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTBLC]=[AMTBLC]+ISNULL((SELECT sum([AMTBLC]) as [AMTBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTLASTDR]=[AMTLASTDR]+ISNULL((SELECT sum([AMTLASTDR]) as [AMTLASTDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTLASTCR]=[AMTLASTCR]+ISNULL((SELECT sum([AMTLASTCR]) as [AMTLASTCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[AMTLASTBLC]=[AMTLASTBLC]+ISNULL((SELECT sum([AMTLASTBLC]) as [AMTLASTBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYYEARDR]=[FCYYEARDR]+ISNULL((SELECT sum([FCYYEARDR]) as [FCYYEARDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYYEARCR]=[FCYYEARCR]+ISNULL((SELECT sum([FCYYEARCR]) as [FCYYEARCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYYEARBLC]=[FCYYEARBLC]+ISNULL((SELECT sum([FCYYEARBLC]) as [FCYYEARBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYDR]=[FCYDR]+ISNULL((SELECT sum([FCYDR]) as [FCYDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYCR]=[FCYCR]+ISNULL((SELECT sum([FCYCR]) as [FCYCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYBLC]=[FCYBLC]+ISNULL((SELECT sum([FCYBLC]) as [FCYBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYLASTDR]=[FCYLASTDR]+ISNULL((SELECT sum([FCYLASTDR]) as [FCYLASTDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYLASTCR]=[FCYLASTCR]+ISNULL((SELECT sum([FCYLASTCR]) as [FCYLASTCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[FCYLASTBLC]=[FCYLASTBLC]+ISNULL((SELECT sum([FCYLASTBLC]) as [FCYLASTBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYYEARDR]=[QTYYEARDR]+ISNULL((SELECT sum([QTYYEARDR]) as [QTYYEARDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYYEARCR]=[QTYYEARCR]+ISNULL((SELECT sum([QTYYEARCR]) as [QTYYEARCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYYEARBLC]=[QTYYEARBLC]+ISNULL((SELECT sum([QTYYEARBLC]) as [QTYYEARBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYDR]=[QTYDR]+ISNULL((SELECT sum([QTYDR]) as [QTYDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYCR]=[QTYCR]+ISNULL((SELECT sum([QTYCR]) as [QTYCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYBLC]=[QTYBLC]+ISNULL((SELECT sum([QTYBLC]) as [QTYBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYLASTDR]=[QTYLASTDR]+ISNULL((SELECT sum([QTYLASTDR]) as [QTYLASTDR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYLASTCR]=[QTYLASTCR]+ISNULL((SELECT sum([QTYLASTCR]) as [QTYLASTCR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[QTYLASTBLC]=[QTYLASTBLC]+ISNULL((SELECT sum([QTYLASTBLC]) as [QTYLASTBLC] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[PFADR]=[PFADR]+ISNULL((SELECT sum([PFADR]) as [PFADR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0),[PFACR]=[PFACR]+ISNULL((SELECT sum([PFACR]) as [PFACR] from cw_genleg_accitems as a where [YEAR]=cw_genleg_accitems.[YEAR] and [MONTH]=cw_genleg_accitems.[MONTH] and [LINKGID]=cw_genleg_accitems.[LINKGID] and [DEPTACC]=cw_genleg_accitems.[DEPTACC] and [EMPLACC]=cw_genleg_accitems.[EMPLACC] and [CORPACC]=@oldSHORTNAME and [ITEMACC]=cw_genleg_accitems.[ITEMACC] and [CURRENCY]=cw_genleg_accitems.[CURRENCY] and [STARTGID]=cw_genleg_accitems.[STARTGID] and [ACCDATE]=cw_genleg_accitems.[ACCDATE] and [CORPID]=cw_genleg_accitems.[CORPID]),0) WHERE [CORPACC] = @newSHORTNAME
--SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
DELETE from cw_genleg_accitems where gid in (SELECT a.gid from cw_genleg_accitems as a,(SELECT * from cw_genleg_accitems where [CORPACC] = @newSHORTNAME) as b where a.[CORPACC] = @oldSHORTNAME and a.[YEAR]=b.[YEAR] and a.[MONTH]=b.[MONTH] and a.[LINKGID]=b.[LINKGID] and a.[DEPTACC]=b.[DEPTACC] and a.[EMPLACC]=b.[EMPLACC] and a.[ITEMACC]=b.[ITEMACC] and a.[CURRENCY]=b.[CURRENCY] and a.[STARTGID]=b.[STARTGID] and a.[ACCDATE]=b.[ACCDATE] and a.[CORPID]=b.[CORPID])
--SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE cw_genleg_accitems SET [CORPACC] = @newSHORTNAME WHERE [CORPACC] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
--SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
-------------------------------------------------
---Begin 2014-02-24 <20><><EFBFBD>Ӳִ<D3B2><D6B4><EFBFBD><EFBFBD>ر<EFBFBD>--------------------
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>/<2F>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE wms SET ARCLIENT = @newSHORTNAME WHERE ARCLIENT = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> װж<D7B0><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D3A6><EFBFBD>˿<EFBFBD><CBBF>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms SET TRUCKNAME = @newSHORTNAME WHERE TRUCKNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ԭ<>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms SET CLIENTNAMEOLD = @newSHORTNAME WHERE CLIENTNAMEOLD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_in SET CLIENTNAME = @newSHORTNAME WHERE CLIENTNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_in SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> ԭ<>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_in SET CLIENTNAMEOLD = @newSHORTNAME WHERE CLIENTNAMEOLD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_out SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_out SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> װж<D7B0><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D3A6><EFBFBD>˿<EFBFBD><CBBF>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_out SET TRUCKNAME = @newSHORTNAME WHERE TRUCKNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> <20><>Ȩת<C8A8>ƵĿͻ<C4BF><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_out SET CLIENTNAMEOLD = @newSHORTNAME WHERE CLIENTNAMEOLD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>/<2F>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD>ͻ<EFBFBD>
UPDATE wms_out SET ARCLIENT = @newSHORTNAME WHERE ARCLIENT = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><>λ<EFBFBD><CEBB>Ϣ<EFBFBD><CFA2> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_storage_area SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ʱ<EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_rate SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_rate_detail SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ò<EFBFBD>ѯʵʱ<CAB5><CAB1> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_wmsrate_test SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ò<EFBFBD>ѯʵʱ<CAB5><CAB1> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_wmsrate_test SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ִ<EFBFBD><D6B4><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_fee SET CLIENTNAME = @newSHORTNAME WHERE CLIENTNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ִ<EFBFBD><D6B4><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
UPDATE wms_fee SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD><EFBFBD>
UPDATE Import_main SET buyer = @newSHORTNAME WHERE buyer = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD><EFBFBD>
UPDATE Import_Sales SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3> <20><><EFBFBD><EFBFBD>
UPDATE Import_Delivery SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--185. <09>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B5A5>ϸ<EFBFBD><CFB8>(wms_settlement_detail) <20><><EFBFBD><EFBFBD>
UPDATE wms_settlement_detail SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--185. <09>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B5A5>ϸ<EFBFBD><CFB8>(wms_settlement_detail) <20>ֿ<EFBFBD>
UPDATE wms_settlement_detail SET STORAGENAME = @newSHORTNAME WHERE STORAGENAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--188. <09>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B5A5><EFBFBD><EFBFBD>(wms_settlement_list) <20><><EFBFBD>˿ͻ<CBBF>
UPDATE wms_settlement_detail SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
---End
---Begin 2017-01-10 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>--------------------
--170. <09><><EFBFBD>۵<EFBFBD><DBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>crm_quotation<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
UPDATE crm_quotation SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--171. <09><><EFBFBD>۵<EFBFBD><DBB5><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>crm_quotation_detail<69><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
UPDATE crm_quotation SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_seai SET [CUSTOMERNAME] = @newSHORTNAME WHERE [CUSTOMERNAME] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><>վ
UPDATE op_seai SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>˾
UPDATE op_seai SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>
UPDATE op_seai SET FORWARDER = @newSHORTNAME WHERE FORWARDER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_seai SET CUSTOMSER = @newSHORTNAME WHERE CUSTOMSER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_seai SET TRUCKER = @newSHORTNAME WHERE TRUCKER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_seai SET AGENTID= @newSHORTNAME WHERE AGENTID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20>ֿ<EFBFBD>
UPDATE op_seai SET WAREHOUSE= @newSHORTNAME WHERE WAREHOUSE = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><>ͷ
UPDATE op_seai SET matou= @newSHORTNAME WHERE MaTou = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
UPDATE op_seai SET SHIPAGENCY= @newSHORTNAME WHERE SHIPAGENCY = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_InternalTrade SET [CUSTOMERNAME] = @newSHORTNAME WHERE [CUSTOMERNAME] = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><>վ
UPDATE op_InternalTrade SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>˾
UPDATE op_InternalTrade SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_InternalTrade SET TRUCKER = @newSHORTNAME WHERE TRUCKER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_InternalTrade SET TRUCKER2 = @newSHORTNAME WHERE TRUCKER2 = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--191. <09><><EFBFBD><EFBFBD>op_other <20>ۺ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_other SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ۺ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_other SET CUSTOMSER = @newSHORTNAME WHERE CUSTOMSER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>ۺ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֿ<EFBFBD>
UPDATE op_other SET WAREHOUSE= @newSHORTNAME WHERE WAREHOUSE = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--194. <09><><EFBFBD><EFBFBD>op_sub_seaorder<65>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD>ձ<EFBFBD>
UPDATE op_sub_seaorder SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--208. <09><><EFBFBD><EFBFBD>op_seae_edi<64><69><EFBFBD><EFBFBD>EDI<44><49> <20><>վ
UPDATE op_seae_edi SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--208. <09><><EFBFBD><EFBFBD>op_seae_edi<64><69><EFBFBD><EFBFBD>EDI<44><49> <20><><EFBFBD><EFBFBD>
--UPDATE op_seae_edi SET FOWARDER = @newSHORTNAME WHERE FOWARDER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
--SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--208. <09><><EFBFBD><EFBFBD>op_seae_edi<64><69><EFBFBD><EFBFBD>EDI<44><49> <20><><EFBFBD><EFBFBD>˾
UPDATE op_seae_edi SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--218. <09><><EFBFBD><EFBFBD>op_railway<61><79>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_railway SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--218. <09><><EFBFBD><EFBFBD>op_railway<61><79>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_railway SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--218. <09><><EFBFBD><EFBFBD>op_railway<61><79>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_railway SET CUSTOMTRANSITCORP = @newSHORTNAME where CUSTOMTRANSITCORP= @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_railway SET RETURNCTNCORP = @newSHORTNAME where RETURNCTNCORP= @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_railway SET RECEIVEYARD = @newSHORTNAME where RECEIVEYARD= @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--219. <09><><EFBFBD><EFBFBD>op_railway_bill <20><>·<EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_railway_bill SET SHIPPERID = @newSHORTNAME WHERE SHIPPERID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--219. <09><><EFBFBD><EFBFBD>op_railway_bill <20><>·<EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ <20>ջ<EFBFBD><D5BB><EFBFBD>
UPDATE op_railway_bill SET CONSIGNEEID = @newSHORTNAME WHERE CONSIGNEEID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--220. <09><><EFBFBD><EFBFBD>op_railway_bill_road <20><>·<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_railway_bill_road SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--221. <09><><EFBFBD><EFBFBD>op_railway_bill_train <20><>·<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_railway_bill_train SET CARRIER = @newSHORTNAME WHERE CARRIER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_aire SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_aire SET SHIPPERID = @newSHORTNAME WHERE SHIPPERID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20>ջ<EFBFBD><D5BB><EFBFBD>
UPDATE op_aire SET CONSIGNEEID = @newSHORTNAME WHERE CONSIGNEEID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ֪ͨ<CDA8><D6AA>
UPDATE op_aire SET NOTIFYPARTYID = @newSHORTNAME WHERE NOTIFYPARTYID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_aire SET AGENTID = @newSHORTNAME WHERE AGENTID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>չ<EFBFBD>˾
UPDATE op_aire SET AIRLINES = @newSHORTNAME WHERE AIRLINES = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>չ<EFBFBD>˾
UPDATE op_aire SET FORWARDER = @newSHORTNAME WHERE FORWARDER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_aire SET CUSTOMSER = @newSHORTNAME WHERE CUSTOMSER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--223. <09><><EFBFBD><EFBFBD>op_aire<72><65><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_aire SET TRUCKER = @newSHORTNAME WHERE TRUCKER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ί<>е<EFBFBD>λ
UPDATE op_airi SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_airi SET SHIPPERID = @newSHORTNAME WHERE SHIPPERID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20>ջ<EFBFBD><D5BB><EFBFBD>
UPDATE op_airi SET CONSIGNEEID = @newSHORTNAME WHERE CONSIGNEEID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> ֪ͨ<CDA8><D6AA>
UPDATE op_airi SET NOTIFYPARTYID = @newSHORTNAME WHERE NOTIFYPARTYID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_airi SET AGENTID = @newSHORTNAME WHERE AGENTID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>չ<EFBFBD>˾
UPDATE op_airi SET AIRLINES = @newSHORTNAME WHERE AIRLINES = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>չ<EFBFBD>˾
UPDATE op_airi SET FORWARDER = @newSHORTNAME WHERE FORWARDER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_airi SET CUSTOMSER = @newSHORTNAME WHERE CUSTOMSER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--224. <09><><EFBFBD><EFBFBD>op_airi<72><69><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> <20><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
UPDATE op_airi SET TRUCKER = @newSHORTNAME WHERE TRUCKER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--225. <09><><EFBFBD><EFBFBD>op_aire_bill<6C><6C><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_aire_bill SET SHIPPERID = @newSHORTNAME WHERE SHIPPERID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--225. <09><><EFBFBD><EFBFBD>op_aire_bill<6C><6C><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><20>ջ<EFBFBD><D5BB><EFBFBD>
UPDATE op_aire_bill SET CONSIGNEEID = @newSHORTNAME WHERE CONSIGNEEID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--225. <09><><EFBFBD><EFBFBD>op_aire_bill<6C><6C><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ᵥ ֪ͨ<CDA8><D6AA>
UPDATE op_aire_bill SET NOTIFYPARTYID = @newSHORTNAME WHERE NOTIFYPARTYID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--225. <09><><EFBFBD><EFBFBD>op_aire_bill<6C><6C><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE op_aire_bill SET AGENTID = @newSHORTNAME WHERE AGENTID = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_express SET EXPRESSCORP = @newSHORTNAME WHERE EXPRESSCORP = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_express SET SENDERCUST = @newSHORTNAME WHERE SENDERCUST = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_express SET RECEIVECUST = @newSHORTNAME WHERE RECEIVECUST = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_truck_bulk SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_truck_bulk SET YARD = @newSHORTNAME WHERE YARD = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_truck_bulk_pc SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_truck_bulk_pc SET TRUCKER = @newSHORTNAME WHERE TRUCKER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
UPDATE op_truck_bulk_pc SET YARD = @newSHORTNAME WHERE YARD= @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
---End
---Begin <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--226. <09><><EFBFBD><EFBFBD>tMsWlBsHead <20>ɳ<EFBFBD>ҵ<EFBFBD><D2B5> ί<>е<EFBFBD>λ
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlBsHead]') AND type in (N'U'))
UPDATE tMsWlBsHead SET CustName = @newSHORTNAME,CustCode=@newCODENAME WHERE CustName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--227. <09><><EFBFBD><EFBFBD>tMsWlBulkHead <20>ɳ<EFBFBD>ҵ<EFBFBD><D2B5> ί<>е<EFBFBD>λ
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlBulkHead]') AND type in (N'U'))
UPDATE tMsWlBulkHead SET CustName = @newSHORTNAME,CustCode=@newCODENAME WHERE CustName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlDjHead]') AND type in (N'U'))
UPDATE tMsWlDjHead SET CustName = @newSHORTNAME,CustCode=@newCODENAME WHERE CustName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlDjPound]') AND type in (N'U'))
UPDATE tMsWlDjPound SET CustName = @newSHORTNAME,CustCode=@newCODENAME WHERE CustName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlPcHead]') AND type in (N'U'))
UPDATE tMsWlPcHead SET CustName = @newSHORTNAME,CustCode=@newCODENAME WHERE CustName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlPcHead]') AND type in (N'U'))
UPDATE tMsWlPcHead SET YardName = @newSHORTNAME,YardCode=@newCODENAME WHERE YardName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlPcHead]') AND type in (N'U'))
UPDATE tMsWlPcHead SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlPcHead]') AND type in (N'U'))
UPDATE tMsWlPcHead SET F_CustomerName = @newSHORTNAME WHERE F_CustomerName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tMsWlPcHead]') AND type in (N'U'))
UPDATE tMsWlPcHead SET DispatchName = @newSHORTNAME WHERE DispatchName = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
--<2D>²ִ<C2B2><D6B4><EFBFBD><EFBFBD>ر<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS]') AND type in (N'U'))
UPDATE OP_WMS SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D>ִ<EFBFBD>ҵ<EFBFBD><D2B5> <20>ͻ<EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS]') AND type in (N'U'))
UPDATE OP_WMS SET GOODSOWNER = @newSHORTNAME WHERE GOODSOWNER = @oldSHORTNAME --<2D>ִ<EFBFBD>ҵ<EFBFBD><D2B5> <20><><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS]') AND type in (N'U'))
UPDATE OP_WMS SET ARCLIENTWMSOUT = @newSHORTNAME WHERE ARCLIENTWMSOUT = @oldSHORTNAME --<2D>ִ<EFBFBD>ҵ<EFBFBD><D2B5> <20>ִ<EFBFBD><D6B4>ѽ<EFBFBD><D1BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_CHECK]') AND type in (N'U'))
UPDATE OP_WMS_CHECK SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_CHECK]') AND type in (N'U'))
UPDATE OP_WMS_CHECK SET GOODSOWNER = @newSHORTNAME WHERE GOODSOWNER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_FEECALENDAR]') AND type in (N'U'))
UPDATE OP_WMS_FEECALENDAR SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_FEEDUI_CUST_DETAIL]') AND type in (N'U'))
UPDATE OP_WMS_FEEDUI_CUST_DETAIL SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_FEEDUI_STORAGE]') AND type in (N'U'))
UPDATE OP_WMS_FEEDUI_STORAGE SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_FEEDUI_STORAGE_DETAIL]') AND type in (N'U'))
UPDATE OP_WMS_FEEDUI_STORAGE_DETAIL SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_FEERATE]') AND type in (N'U'))
UPDATE OP_WMS_FEERATE SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_IN_DO]') AND type in (N'U'))
UPDATE OP_WMS_IN_DO SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_IN_DO]') AND type in (N'U'))
UPDATE OP_WMS_IN_DO SET GOODSOWNER = @newSHORTNAME WHERE GOODSOWNER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_IN_DO]') AND type in (N'U'))
UPDATE OP_WMS_IN_DO SET ARCLIENTWMSOUT = @newSHORTNAME WHERE ARCLIENTWMSOUT = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_IN_PLAN]') AND type in (N'U'))
UPDATE OP_WMS_IN_PLAN SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_IN_PLAN]') AND type in (N'U'))
UPDATE OP_WMS_IN_PLAN SET GOODSOWNER = @newSHORTNAME WHERE GOODSOWNER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_IN_PLAN]') AND type in (N'U'))
UPDATE OP_WMS_IN_PLAN SET ARCLIENTWMSOUT = @newSHORTNAME WHERE ARCLIENTWMSOUT = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_MOVE]') AND type in (N'U'))
UPDATE OP_WMS_MOVE SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_OUT_PLAN]') AND type in (N'U'))
UPDATE OP_WMS_OUT_PLAN SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_OUT_PLAN]') AND type in (N'U'))
UPDATE OP_WMS_OUT_PLAN SET GOODSOWNER = @newSHORTNAME WHERE GOODSOWNER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_OUT_PLAN]') AND type in (N'U'))
UPDATE OP_WMS_OUT_PLAN SET PICKUPNAME = @newSHORTNAME WHERE PICKUPNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_OUT_DO]') AND type in (N'U'))
UPDATE OP_WMS_OUT_DO SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_OUT_DO]') AND type in (N'U'))
UPDATE OP_WMS_OUT_DO SET PICKUPNAME = @newSHORTNAME WHERE PICKUPNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_TRANSFERGOODS]') AND type in (N'U'))
UPDATE OP_WMS_TRANSFERGOODS SET OLDCUSTOMERNAME = @newSHORTNAME WHERE OLDCUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_TRANSFERGOODS]') AND type in (N'U'))
UPDATE OP_WMS_TRANSFERGOODS SET NEWCUSTOMERNAME = @newSHORTNAME WHERE NEWCUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_TRANSFERGOODS]') AND type in (N'U'))
UPDATE OP_WMS_TRANSFERGOODS SET OLD_GOODSOWNER = @newSHORTNAME WHERE OLD_GOODSOWNER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_TRANSFERGOODS]') AND type in (N'U'))
UPDATE OP_WMS_TRANSFERGOODS SET NEW_GOODSOWNER = @newSHORTNAME WHERE NEW_GOODSOWNER = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_TRANSFERGOODS]') AND type in (N'U'))
UPDATE OP_WMS_TRANSFERGOODS SET ARCLIENTWMSOUT = @newSHORTNAME WHERE ARCLIENTWMSOUT = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OP_WMS_WEIGH]') AND type in (N'U'))
UPDATE OP_WMS_WEIGH SET CUSTOMERNAME = @newSHORTNAME WHERE CUSTOMERNAME = @oldSHORTNAME --<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>
SET @errorSun=@errorSun+@@ERROR --<2D>ۼ<EFBFBD><DBBC>Ƿ<EFBFBD><C7B7>д<EFBFBD>
insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER)
values(NEWID(),newid(),'<EFBFBD>ϲ<EFBFBD><EFBFBD>ͻ<EFBFBD>',GETDATE(),@oldSHORTNAME+'<EFBFBD>滻Ϊ'+@newSHORTNAME,@strUserName)
---End
IF @errorSun<>0
BEGIN
ROLLBACK TRANSACTION--<2D><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><D8B9><EFBFBD><EFBFBD><EFBFBD>
return 0
END
ELSE
BEGIN
COMMIT TRANSACTION--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>
return 1
END
set nocount off
END
GO
ALTER VIEW [dbo].[VW_OP_WMS_IN_PLAN] AS select [WMSPLANID]
,[WMSNO]
,[MBLNO]
,[CONTRACTNO]
,[BILLTYPE]
,[PLANTIME]
,[ACCDATE]
,[CUSTOMERNAME]
,[CORPID]
,[KGS]
,[PKGS]
,[CBM]
,[GOODSNAME]
,[KINDPKGS]
,[STORAGEUNIT]
,[STORAGEUNITCOUNT]
,[RULEUNIT]
,[RULEUNITCOUNT]
,[REMARK]
,[BSSOURCE]
,[Creator]
,[CreateID]
,[CreateDate]
,[FEESTATUS]
,[BSSTATUS]
,[TIMEMARK]
,[ModifyDate]
,[ModifyID]
,[Modifier]
,[ISEND]
,[MASTERBSNO]
,[NETWEIGHT]
,[CUSTOMNO]
,[ETA]
,[CTNNUM]
,[JINJINGBEIANSHENBAORIQI]
,[JINGNEISHOUHUOREN]
,[INSPECTION_NO]
,[PLAN_GETTIME]
,[CUSTOMAMOUNT]
,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE
,GOODSOWNER
,BILLSTATUS,ARCLIENTWMSOUT,APCLIENTWMSOUT,COUNTRY,ISRULECHECK
FROM [OP_WMS_IN_PLAN]
GO
ALTER VIEW [dbo].[VW_OP_WMS_IN_DO] AS select D.[BSNO]
,[WMSDOID]
,[WMS_PLAN_BSNO]
,[BILLTYPE]
,[CUSTOMERNAME]
,[MATERIALNO]
,[GOODSCODE]
,[GOODSNAME]
,[GOODSHSCODE]
,[MBLNO]
,[PAYEDTAXES]
,[BSSTATUS]
,[CreateDate]
,[Creator]
,[CreateID]
,[REMARK]
,[FEESTATUS]
,[BILLSTATUS]
,[DODATE]
,[CORPID]
,[CUSTOMNO]
,[GOODSOWNER]
,[TRUCKNO],dbo.F_INDODETAIL_CNTRNO(d.WMSDOID) CNTRNO,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE,ARCLIENTWMSOUT,APCLIENTWMSOUT,
(select count(CNTRNO) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) CTNNUM,
isnull((select sum(KGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) KGS,
isnull((select sum(NETWEIGHT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) NETWEIGHT,
isnull((select sum(CBM) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) CBM,
isnull((select sum(PKGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) PKGS,
(select top 1 KINDPKGS from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) KINDPKGS,
(select top 1 STORAGEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) STORAGEUNIT,
(select top 1 RULEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) RULEUNIT,
isnull((select sum(STORAGEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) STORAGEUNITCOUNT,
isnull((select sum(RULEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) RULEUNITCOUNT
from OP_WMS_IN_DO D
GO
ALTER VIEW [dbo].[VW_OP_WMS_IN_DO_ACCEPT] AS select D.[BSNO]
,[WMSDOID]
,[WMS_PLAN_BSNO]
,[BILLTYPE]
,[CUSTOMERNAME]
,[GOODSOWNER]
,[ARCLIENTWMSOUT]
,[APCLIENTWMSOUT]
,[MATERIALNO]
,[GOODSCODE]
,[GOODSNAME]
,[GOODSHSCODE]
,[MBLNO]
,[PAYEDTAXES]
,[BSSTATUS]
,[CreateDate]
,[Creator]
,[CreateID]
,[REMARK]
,[FEESTATUS]
,[BILLSTATUS]
,[DODATE]
,[CORPID]
,[CUSTOMNO]
,dbo.F_INDODETAIL_CNTRNO(d.WMSDOID) CNTRNO,(select top 1 GOODSFEETYPE from code_goods where GOODNAME=GOODSNAME)GOODSFEETYPE,
(select count(CNTRNO) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) CTNNUM,
isnull((select sum(KGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) KGS,
isnull((select sum(NETWEIGHT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) NETWEIGHT,
isnull((select sum(CBM) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) CBM,
isnull((select sum(PKGS) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) PKGS,
(select top 1 KINDPKGS from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) KINDPKGS,
(select top 1 STORAGEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) STORAGEUNIT,
(select top 1 RULEUNIT from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid) RULEUNIT,
isnull((select sum(STORAGEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) STORAGEUNITCOUNT,
isnull((select sum(RULEUNITCOUNT) from OP_WMS_IN_DO_GOODS where WMSDOID=d.wmsdoid),0) RULEUNITCOUNT
from OP_WMS_IN_DO D
GO
ALTER VIEW [dbo].[v_op_bs]
as
SELECT BSNO,MASTERNO, 'op_seae' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
,dbo.trimdate(STLDATE) STLDATE, STLNAME, VESSEL, VOYNO, INPUTBY,BLTYPE,
CREATETIME, BSSTATUS, SALE , OP , DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE,CUSTOMNO,
ACCDATE,CARRIER, BSSOURCE,BSSOURCEDETAIL, LANE, FORWARDER, 0 AS NETWEIGHT, KGS,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN TEU ELSE 0 END TEU, CNTRTOTAL,
CORPID,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR1 ELSE 0 END CNTR1,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR2 ELSE 0 END CNTR2,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR3 ELSE 0 END CNTR3, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR4 ELSE 0 END CNTR4,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR5 ELSE 0 END CNTR5,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR6 ELSE 0 END CNTR6,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR7 ELSE 0 END CNTR7, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR8 ELSE 0 END CNTR8,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR9 ELSE 0 END CNTR9,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR10 ELSE 0 END CNTR10,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN OTCNTR ELSE 0 END OTCNTR, '' AS TRADETYPE, GOODSNAME,
FEESTATUS,ETD AS OPDATE,CUSTOMDATE,'' ENTERP,PKGS,CBM,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,''BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,OPERATOR,SERVICECONTRACTNO,ISCANCEL
,APPLYNO,ISSUETYPE,BLISSUESTATUS,REMARK,TRADETERM,PLACERECEIPT,DESTINATION,CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,DESTINATIONID,SALECORPID,YARD,DELIVERYDATE,FRCUSTSERVICE,SERVICE,OPERATORFAX REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,CLOSINGDATE,KINDPKGS,CARGOID,DCLASS
FROM dbo.op_seae WITH (NOLOCK)
UNION ALL
SELECT BSNO,MASTERNO, 'op_seai' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL, VOYNO, INPUTBY,BLTYPE,
CREATETIME, BSSTATUS, SALE ,OP , DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO,ACCDATE,
CARRIER, BSSOURCE,BSSOURCEDETAIL, LANE, FORWARDER, NETWEIGHT, KGS,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN TEU ELSE 0 END TEU, CNTRTOTAL,
CORPID,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR1 ELSE 0 END CNTR1,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR2 ELSE 0 END CNTR2,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR3 ELSE 0 END CNTR3, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR4 ELSE 0 END CNTR4,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR5 ELSE 0 END CNTR5,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR6 ELSE 0 END CNTR6,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR7 ELSE 0 END CNTR7, CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR8 ELSE 0 END CNTR8,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR9 ELSE 0 END CNTR9,CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN CNTR10 ELSE 0 END CNTR10,
CASE WHEN (BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' OR BLTYPE='ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ') THEN OTCNTR ELSE 0 END OTCNTR, TRADETYPE, GOODSNAME,
FEESTATUS,ETD AS OPDATE,CUSTOMDATE,ENTERP,PKGS,CBM,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,''BOOKNO,AGENTID,ISPRINTPR,NUMBERPLATE,0 FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,APPLYNO,ISSUETYPE,BLISSUESTATUS,REMARK,TRADETERM,PLACERECEIPT,DESTINATION,CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,DESTINATIONID,SALECORPID,YARD,TIHUOTIME DELIVERYDATE,FRCUSTSERVICE,SERVICE,REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,CARGOID,DCLASS
FROM dbo.op_seai WITH (NOLOCK)
UNION ALL
SELECT BSNO,MASTERNO, 'op_aire' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL,'' VOYNO, INPUTBY,BLTYPE,
CREATETIME, BSSTATUS, SALE , OP ,'' DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO,
ACCDATE,AIRLINES CARRIER, BSSOURCE,BSSOURCEDETAIL,LANE, FORWARDER, FEEKGS AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE, GOODSNAME,
FEESTATUS,ETD AS OPDATE,CUSTOMDATE,'' ENTERP,PKGS,CBM ,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,'' BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE,FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,DELIVERYDATE,FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_aire WITH (NOLOCK)
UNION ALL
SELECT BSNO, MASTERNO,'op_airi' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETA) ETD,dbo.trimtime(ETA) ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL,'' VOYNO, INPUTBY,BLTYPE,
CREATETIME, BSSTATUS, SALE ,OP ,'' DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE,CUSTOMNO,
ACCDATE,AIRLINES CARRIER, BSSOURCE,BSSOURCEDETAIL,LANE, FORWARDER, FEEKGS AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE, GOODSNAME,
FEESTATUS,ETA AS OPDATE,CUSTOMDATE,'' ENTERP,PKGS,CBM,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,'' BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE,FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID ,'' YARD,DELIVERYDATE,FRCUSTSERVICE,SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_airi WITH (NOLOCK)
UNION ALL
SELECT BSNO, MASTERNO,'op_apply' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=96004 and EnumValueID=OP_APPLY.BsType) as BSTYPE,CUSTOMERNAME, CUSTNO,'' ORDERNO, MBLNO, HBLNO, CUSTOMDATE as ETD,'' ETA
,'' STLDATE,'' STLNAME, VESSEL, VOYNO, INPUTBY,CUSTOMTYPE BLTYPE,
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE, CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,TEU,'' CNTRTOTAL,
CORPID,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,OPDATE,CUSTOMDATE,ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,BSCUSTOMNO,
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_apply WITH (NOLOCK)
UNION ALL
SELECT BSNO, BSNO MASTERNO,'op_other' AS OPLB, '<EFBFBD>ۺ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,TRANSTYPE as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO, MBLNO, HBLNO, ETD,'' ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL, VOYNO,OP AS INPUTBY,'' BLTYPE,
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_other WITH (NOLOCK)
UNION ALL
SELECT BSNO,BSNO MASTERNO, 'op_bulk' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɢ<EFBFBD><EFBFBD>' AS OPLBNAME,TRANSTYPE as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,'' MBLNO,'' HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_bulk WITH (NOLOCK)
UNION ALL
SELECT ContractNo AS BSNO, ContractNo MASTERNO,'import_main' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD>' AS BSTYPE, buyer AS CUSTOMERNAME, HTH AS CUSTNO,Supplier_Billno+' '+Other_Billno ORDERNO, billno as MblNo, M.ContainerNo AS HBLNO, dbo.trimdate(Arrivaldate) AS ETD,dbo.trimtime(M.ArrivalDate) ETA
,'' STLDATE,'' STLNAME, VESSEL,voyage as VOYNO, (select showname from [user] where codename=creator) AS INPUTBY,'' BLTYPE,
CREATTIME as CREATETIME,isnull(BSSTATUS,0) AS BSSTATUS, (select showname from [user] where codename=creator) AS SALE, OP AS OP, op AS DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) AS PORTDISCHARGE, '' AS CUSTOMNO,
case when isnull(ACCDATE,'')='' then '' else dbo.trimdate(ACCDATE) end ACCDATE ,
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
isnull(FEESTATUS,0) FEESTATUS,Arrivaldate AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'',ISVOU,'' VOUNO ,'' DESTINATIONID,M.company SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,null BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.import_main M WITH (NOLOCK)
UNION ALL
SELECT BSNO,MASTERNO, 'op_railway' AS OPLB, '<EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO,HBLNO,SETOUTDATE ETD,'' ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
BSDATE AS CREATETIME, BSSTATUS, SALE, OP,'' DOC,CUSTSERVICE, PLACELOAD,DESTINATIONENAME AS PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,SETOUTDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO ,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,PLACERECEIPT,DESTINATION,'' CNTRSEALNO ,BillFeeStatus,ISVOU,VOUNO,DESTINATIONENAME DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_railway WITH (NOLOCK)
UNION ALL
SELECT GId BSNO,GId MASTERNO, 'tMsWlPcHead' AS OPLB, '½<EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'½<EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><EFBFBD><EFBFBD>' as BSTYPE,CUSTOMERNAME,Billno CUSTNO,'' ORDERNO,MBLNO MBLNO,'' HBLNO,dbo.trimdate(ExpDate) ETD,dbo.trimdate(RtnDocTime) ETA
,'' STLDATE,'' STLNAME,TruckNo VESSEL,(select top 1 DrvName from tMsWlDriver where DrvCode=dbo.tMsWlPcHead.DrvCode) VOYNO,(select top 1 showname from [user] where CODENAME=DdCode) INPUTBY, BLTYPE,
'' CREATETIME,BillStatus BSSTATUS,SalesName SALE,case isnull(UserName,'') when '' then (select top 1 showname from [user] where CODENAME=DdCode) else UserName end OP,'' DOC,'' CUSTSERVICE,LoadPlace PLACELOAD,DstArea PORTDISCHARGE,'' CUSTOMNO,
case when dbo.trimdate(ExpDate)<>'' then LEFT(dbo.trimdate(ExpDate),7) else '' end ACCDATE ,'' CARRIER,'' BSSOURCE,'' BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,
(select top 1 Ctn from code_ctn where CtnId=dbo.tMsWlPcHead.ContainerType)+'*'+convert(varchar(20),dbo.tMsWlPcHead.ContainerQty) CNTRTOTAL,
(select top 1 GID from company where codename=dbo.tMsWlPcHead.orgcode) CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,dbo.trimdate(ExpDate) OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,RtnDocStatus BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO,DstArea DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.tMsWlPcHead WITH (NOLOCK)
UNION ALL
SELECT F_NO AS BSNO,F_NO MASTERNO, 'import_finance' AS OPLB, 'ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMER AS CUSTOMERNAME, F_NO AS CUSTNO,f.HTH ORDERNO, F.Billno MblNo,'' HBLNO, STARTDATE AS ETD,'' ETA
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO, (select showname from [user] where gid=M.OP) AS INPUTBY,'' BLTYPE,
ENTERDATE as CREATETIME, 0 BSSTATUS, '' AS SALE, (select showname from [user] where gid=M.OP) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, '' AS CUSTOMNO,
case when isnull(STARTDATE,'')='' then '' else dbo.trimdate(STARTDATE) end ACCDATE ,
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
'' CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
0 FEESTATUS,STARTDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,'' REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,'' ,M.ISVOU,'' VOUNO ,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,null BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.IMPORT_FINANCE M WITH (NOLOCK)
left join [dbo].[Import_main] f on (f.ContractNo=M.MAINNO)
UNION ALL
SELECT ASSOCIATEDNO AS BSNO,ASSOCIATEDNO MASTERNO, 'WMS' AS OPLB, '<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, WMSNO AS CUSTNO,WMSNO ORDERNO, BLNO MblNo,'' HBLNO, WMSDATE AS ETD,'' ETA
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO,(select top 1 showname from [user] where gid= createuser) AS INPUTBY,'' BLTYPE,
CREATETIME as CREATETIME, 0 BSSTATUS, '' AS SALE, (select top 1 showname from [user] where gid=MODIFIEDUSER) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, '' AS CUSTOMNO,
case when isnull(WMSDATE,'')='' then '' else dbo.trimdate(WMSDATE) end ACCDATE ,
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
'' CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,WMSDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,'' REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus,ISVOU,VOUNO ,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.WMS WITH (NOLOCK) where ASSOCIATEDNO=gid
UNION ALL
SELECT GID AS BSNO, GID MASTERNO,'WMS_IN' AS OPLB, '<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, WMSNO AS CUSTNO,WMSNO ORDERNO, BLNO MblNo,'' HBLNO, WMSDATE AS ETD,'' ETA
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO,WMSOP AS INPUTBY,'' BLTYPE,
CREATETIME as CREATETIME, 0 BSSTATUS, '' AS SALE, (select top 1 showname from [user] where gid=WMS.MODIFIEDUSER) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, CUSTOMNO, ACCDATE ,
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,GOODSNAME,
FEESTATUS,WMSDATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus,ISVOU,VOUNO,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.WMS WITH (NOLOCK) where ASSOCIATEDNO<>gid
UNION ALL
SELECT GID AS BSNO,GID MASTERNO, 'WMS_OUT' AS OPLB, '<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, BSNO AS CUSTNO,BSNO as ORDERNO, ISNULL(
(select top 1 BLNO from wms where gid = (select top 1 inbsno from wms_out_detail where outbsno = wms_out.bsno)),
(select top 1 BLNO from wms where gid = (select top 1 ASSOCIATEDNO from wms_in where gid = (select top 1 inbsno from wms_out_detail where outbsno = wms_out.bsno)))) MblNo,'' HBLNO, DODATE AS ETD,'' ETA
,'' STLDATE,'' STLNAME,'' VESSEL,'' VOYNO,WMSOP AS INPUTBY,'' BLTYPE,
CREATETIME as CREATETIME, 0 BSSTATUS, '' AS SALE, (select top 1 showname from [user] where gid=wms_out.MODIFIEDUSER) AS OP, '' DOC, '' AS CUSTSERVICE,'' AS PORTLOAD, '' AS PORTDISCHARGE, CUSTOMNO, ACCDATE ,
'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,'' LANE,'' FORWARDER, 0 AS NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,GOODSNAME,
FEESTATUS,DODATE AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO ,'' DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.wms_out WITH (NOLOCK)
UNION ALL
SELECT b.BSNO,b.BSNO MASTERNO, 'op_airn' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME, CUSTNO,ORDERNO,MBLNO, HBLNO,dbo.trimtime(ETD) ETD,dbo.trimtime(ETA) ETA
,dbo.trimdate(STLDATE) STLDATE,STLNAME STLNAME, VESSEL,'' VOYNO, INPUTBY,BLTYPE,
CREATETIME, BSSTATUS, SALE , OP ,'' DOC, CUSTSERVICE, PORTLOAD, PORTDISCHARGE, '' AS CUSTOMNO,
ACCDATE,AIRLINES CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE, FORWARDER
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.[WEIGHT] else d.[WEIGHT] end) AS NETWEIGHT
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.[WEIGHT] else d.[WEIGHT] end) KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE
,c.CARGONAME GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' AS CUSTOMDATE,'' ENTERP
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.BOXCOUNT else d.BOXCOUNT end) PKGS
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.CBM else d.CBM end) CBM
,BLFRT,SALEDEPT,CUSTOMSNUM,INVNO,'' BSCUSTOMNO,
INSPECTIONDATE,INSPECTIONNO,CONTRACTNO,'' BOOKNO,AGENTID,ISPRINTPR,'' as NUMBERPLATE
,(case b.BLTYPE when '<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' then c.[WEIGHT] else d.[WEIGHT] end) FEEKGS,OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO ,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,'' SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_airn b WITH (NOLOCK)
left join OP_AIRN_CARGO C on b.BLTYPE='<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>' and c.bsno = B.bsno
left join OP_AIRN_CARGO D on b.BLTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' and c.bsno =(select top 1 bsno from OP_AIRN where HBLNO=b.HBLNO and BLTYPE='<EFBFBD><EFBFBD><EFBFBD>ڷֵ<EFBFBD>')
UNION ALL
SELECT BSNO, BSNO MASTERNO,'op_truck_bulk' AS OPLB, CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>' END AS OPLBNAME,CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>' END as BSTYPE,CUSTOMERNAME, CUSTNO,ORDERNO,ORDERNO MBLNO,ORDERNO HBLNO, ETD,ETA
,STLDATE,STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
CREATETIME, BSSTATUS, SALE, OP, DDOP AS DOC,CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_truck_bulk WITH (NOLOCK)
UNION ALL
SELECT BSNO,BSNO MASTERNO, 'op_truck_bulk_pc' AS OPLB, CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD>ɳ<EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD>' END AS OPLBNAME,CASE WHEN TRANSTYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '½<EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD>ɳ<EFBFBD>' ELSE '½<EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD>' END as BSTYPE,CUSTOMERNAME, CUSTNO,'' ORDERNO,'' MBLNO,'' HBLNO, ETD,ETA
,STLDATE,STLNAME,'' VESSEL,'' VOYNO,OP AS INPUTBY,'' BLTYPE,
CREATETIME, BSSTATUS,'' SALE, OP, DDOP AS DOC,'' CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER, NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,PKGS,CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,CONTRACTNO,'' BOOKNO,'' AGENTID,ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,ISVOU,VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_truck_bulk_pc WITH (NOLOCK)
UNION ALL
SELECT BSNO,BSNO MASTERNO, 'op_ctnmng' AS OPLB, '<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,BLTYPE as BSTYPE,CUSTOMERNAME,CUSTNO,'' ORDERNO, MBLNO,'' HBLNO,BSDATE ETD,ETD ETA
,'' STLDATE,'' STLNAME, VESSEL, VOYNO,OP AS INPUTBY,BLTYPE BLTYPE,
BSDATE AS CREATETIME, BSSTATUS, SALE, OP, OP AS DOC,'' AS CUSTSERVICE, PORTLOAD, PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,'' CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER,0 NETWEIGHT,0 KGS,TEU, CNTRTOTAL,
CORPID,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT,'' SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,BillFeeStatus ,0 ISVOU,'' VOUNO,PORTDISCHARGE DESTINATIONID,SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_ctnmng WITH (NOLOCK)
UNION ALL
SELECT BSNO,BSNO MASTERNO, 'op_InternalTrade' AS OPLB, '<EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' as BSTYPE,CUSTOMERNAME,CUSTNO,'' ORDERNO, MBLNO,'' HBLNO,dbo.trimdate(ETD) ETD,dbo.trimdate(ETA) ETA
,dbo.trimdate( STLDATE) STLDATE,STLNAME, VESSEL, VOYNO,OP AS INPUTBY,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' BLTYPE,
BSDATE AS CREATETIME, BSSTATUS,(select showname from [user] where GID=SALE ) SALE, OP, OP AS DOC, CUSTSERVICE, PORTLOADID+'_'+PORTLOAD PORTLOAD, PORTDISCHARGEID+'_'+PORTDISCHARGE PORTDISCHARGE,'' CUSTOMNO,
ACCDATE,CARRIER, BSSOURCE,BSSOURCEDETAIL,'' LANE,'' FORWARDER,0 NETWEIGHT,0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,ETD AS OPDATE,'' CUSTOMDATE,'' ENTERP,0 PKGS,0 CBM,'' BLFRT, SALEDEPT,0 CUSTOMSNUM,'' INVNO,'' BSCUSTOMNO,
'' INSPECTIONDATE,'' INSPECTIONNO,'' CONTRACTNO,'' BOOKNO,'' AGENTID,'' ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS, OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,isnull(PORTLOADREMARK,'')+';;'+isnull(VIA_MARK,'') remark,'' TRADETERM,'' PLACERECEIPT,PlACERECEIPT DESTINATION,SEALNO CNTRSEALNO
,BillFeeStatus ,0 ISVOU,'' VOUNO,PORTDISCHARGE DESTINATIONID,CORPID SALECORPID,'' YARD,dbo.trimtime(DELIVERYDATE) DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.op_InternalTrade WITH (NOLOCK)
union all
SELECT Convert(varchar(36),WMSDOID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_IN_DO' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>' BLTYPE,
CreateDate CREATETIME, BSSTATUS,'' SALE ,(select SHOWNAME from vw_user where USERID=CreateID ) OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, KGS AS NETWEIGHT, KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE, GOODSNAME,
FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP,PKGS,CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,KGS FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.VW_OP_WMS_IN_DO
union all
SELECT Convert(varchar(36),OP_WMS_OUT_DO_BSNO.GID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_OUT_DO' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,WMSNO CUSTNO,WMSNO ORDERNO,OP_WMS_OUT_DO.MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
,null STLDATE,null STLNAME,'' VESSEL,OP_WMS_OUT_DO.TRUCKNO VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ' BLTYPE,
CreateDate CREATETIME, BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) AS NETWEIGHT, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, isnull((select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0)PKGS, isnull((select sum(CBM) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.OP_WMS_OUT_DO_BSNO left join dbo.OP_WMS_OUT_DO on OP_WMS_OUT_DO.WMSDOID=OP_WMS_OUT_DO_BSNO.BSNO
union all
SELECT Convert(varchar(36),WMSPLANID) BSNO,Convert(varchar(36),WMSPLANID) MASTERNO, 'VW_OP_WMS_OUT_PLAN' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,WMSNO CUSTNO,WMSNO ORDERNO,VW_OP_WMS_OUT_PLAN.MBLNO,'' HBLNO,dbo.trimtime(PLANTIME) ETD,dbo.trimtime(PLANTIME) ETA
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' BLTYPE,
CreateDate CREATETIME, BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),PLANTIME,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, isnull((select sum(NETWEIGHT) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=VW_OP_WMS_OUT_PLAN.WMSPLANID),0) AS NETWEIGHT, isnull((select sum(kgs) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=VW_OP_WMS_OUT_PLAN.WMSPLANID),0) KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,PLANTIME AS OPDATE,PLANTIME CUSTOMDATE,'' ENTERP, isnull((select sum(PKGS) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=VW_OP_WMS_OUT_PLAN.WMSPLANID),0)PKGS, isnull((select sum(CBM) from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID=VW_OP_WMS_OUT_PLAN.WMSPLANID),0) CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.VW_OP_WMS_OUT_PLAN
union all
SELECT Convert(varchar(36),WMSDOID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_OUT_DO' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,WMSNO CUSTNO,WMSNO ORDERNO,OP_WMS_OUT_DO.MBLNO,'' HBLNO,dbo.trimtime(DODATE) ETD,dbo.trimtime(DODATE) ETA
,null STLDATE,null STLNAME,'' VESSEL,TRUCKNO VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ' BLTYPE,
CreateDate CREATETIME, BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER, isnull((select sum(NETWEIGHT) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) AS NETWEIGHT, isnull((select sum(kgs) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, isnull((select sum(PKGS) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0)PKGS, isnull((select sum(CBM) from OP_WMS_OUT_DO_GOODS where WMSDOID=OP_WMS_OUT_DO.WMSDOID),0) CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,Creator OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.OP_WMS_OUT_DO
union all
SELECT Convert(varchar(36),D.WMSDUIDETAILID) BSNO,Convert(varchar(36),D.WMSDUIID) MASTERNO, 'OP_WMS_FEEDUI' AS OPLB, '<EFBFBD>ִ<EFBFBD><EFBFBD>½<EFBFBD><EFBFBD>˵<EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, D.CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,dbo.trimtime(D.STARTDATE) ETD,dbo.trimtime(D.ENDDATE) ETA
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD>ִ<EFBFBD><EFBFBD>½<EFBFBD>' BLTYPE,
CreateDate CREATETIME,0 BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),h.ACCDATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
FEESTATUS,D.ACCDATE AS OPDATE,D.ACCDATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,h.REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,FEESTATUS BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.OP_WMS_FEEDUI_STORAGE_DETAIL D left join OP_WMS_FEEDUI_STORAGE h on D.WMSDUIID=h.WMSDUIID
union all
SELECT Convert(varchar(36),WMSWEIGHID) BSNO,Convert(varchar(36),WMSWEIGHID) MASTERNO, 'OP_WMS_WEIGH' AS OPLB, '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,MBLNO,'' HBLNO,DODATE ETD,DODATE ETA
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>' BLTYPE,
CreateDate CREATETIME,'' BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
'' FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'' BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.OP_WMS_WEIGH
union all
SELECT Convert(varchar(36),WMSTRANSFERGOODSID) BSNO,Convert(varchar(36),WMSTRANSFERGOODSID) MASTERNO, 'OP_WMS_TRANSFERGOODS' AS OPLB, '<EFBFBD><EFBFBD>תҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, NEWCUSTOMERNAME CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,(select MBLNO from op_wms where wmsid=(select top 1 WMSID from OP_WMS_TRANSFERGOODS_DETAIL where WMSTRANSFERGOODSID=OP_WMS_TRANSFERGOODS.WMSTRANSFERGOODSID))MBLNO,'' HBLNO,TRANSFERDATE ETD,TRANSFERDATE ETA
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD><EFBFBD>תҵ<EFBFBD><EFBFBD>' BLTYPE,
CreateDate CREATETIME,'' BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),TRANSFERDATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
'' FEESTATUS,TRANSFERDATE AS OPDATE,TRANSFERDATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'' BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.OP_WMS_TRANSFERGOODS
union all
SELECT Convert(varchar(36),WMSDOID) BSNO,Convert(varchar(36),WMSDOID) MASTERNO, 'OP_WMS_MOVE' AS OPLB, '<EFBFBD>ƿ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS OPLBNAME,'<EFBFBD>ִ<EFBFBD>ҵ<EFBFBD><EFBFBD>' AS BSTYPE, CUSTOMERNAME,BSNO CUSTNO,BSNO ORDERNO,(select MBLNO from OP_WMS where WMSID=OP_WMS_MOVE.WMSID) MBLNO,'' HBLNO,DODATE ETD,DODATE ETA
,null STLDATE,null STLNAME,'' VESSEL,'' VOYNO, Creator,'<EFBFBD>ƿ<EFBFBD>ҵ<EFBFBD><EFBFBD>' BLTYPE,
CreateDate CREATETIME,'' BSSTATUS,'' SALE ,Creator OP ,'' DOC,'' CUSTSERVICE,'' PORTLOAD,'' PORTDISCHARGE,'' CUSTOMNO,
CONVERT(VARCHAR(7),DODATE,120) ACCDATE,'' CARRIER,'' BSSOURCE,''BSSOURCEDETAIL,''LANE,'' FORWARDER,0 AS NETWEIGHT, 0 KGS,0 TEU,'' CNTRTOTAL,
CORPID,0 CNTR1,0 CNTR2,0 CNTR3,0 CNTR4,0 CNTR5,0 CNTR6,0 CNTR7,0 CNTR8,0 CNTR9,0 CNTR10,0 OTCNTR, '' AS TRADETYPE,'' GOODSNAME,
'' FEESTATUS,DODATE AS OPDATE,DODATE CUSTOMDATE,'' ENTERP, 0 PKGS,0 CBM ,''BLFRT,''SALEDEPT,''CUSTOMSNUM,''INVNO,'' BSCUSTOMNO,
''INSPECTIONDATE,''INSPECTIONNO,''CONTRACTNO,'' BOOKNO,''AGENTID,''ISPRINTPR,'' as NUMBERPLATE,0 FEEKGS,'' OPERATOR,'' SERVICECONTRACTNO,0 ISCANCEL
,'' APPLYNO,'' ISSUETYPE,'' BLISSUESTATUS,REMARK,'' TRADETERM,'' PLACERECEIPT,'' DESTINATION,'' CNTRSEALNO,'' BillFeeStatus,0 ISVOU, '' VOUNO,'' DESTINATIONID,CORPID SALECORPID,'' YARD,'' DELIVERYDATE,'' FRCUSTSERVICE,'' SERVICE,'' REMARK2,'' BILLFEESTATUSTIME,'' TRUCKER,'' CUSTOMSER,null CLOSINGDATE,'' KINDPKGS,'' CARGOID,'' DCLASS
FROM dbo.OP_WMS_MOVE
GO
insert Into code_fee_group values(
'649AACAF-DE14-4E8C-A57B-E763A847AC05','cksl','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',''
)
GO
ALTER VIEW [dbo].[VW_OP_REP_WMSOUTDO] AS
select wc.WMSLOGID,od.DODATE,w.CORPID, w.CUSTOMERNAME,w.GOODSNAME,w.MBLNO,w.CUSTOMNO,w.CNTRNO,-wc.PKGS PKGS,-wc.KGS KGS,-wc.NETWEIGHT NETWEIGHT,-wc.CBM CBM,wc.PKGS3,wc.KGS3,wc.NETWEIGHT3,wc.CBM3,-wc.STORAGEUNITCOUNT STORAGEUNITCOUNT,wc.STORAGEUNITCOUNT3,odg.STOREHOUSE ,odg.AREACODE,w.OP
,wc.CHANGETYPE,od.WMSNO,cg.GOODSFEETYPE,cg.GoodsTypeGID,w.GOODSOWNER
,od.TRUCKNO,w.INDATE,w.WMSINDATE,w.FEESTARTDATE,od.CUSTOMNO CUSTOMNO_OUT
,od.CreateID DO_CreateID
from OP_WMS_CHANGE wc
left join op_wms w on w.WMSID=wc.WMSID
left join op_wms_OUT_do od on od.WMSDOID=wc.DOBSNO
left join OP_WMS_OUT_DO_GOODS odg on odg.WMSDOID=wc.DOBSNO and odg.WMSDODETAILID=wc.DOGID
left join OP_WMS_PHYSICS p on p.WMSPHYSICSID=odg.WMSPHYSICSID
left join code_goods cg on cg.GOODNAME=w.GOODSNAME
where wc.CHANGETYPE='<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
GO
--drop table OP_WMS_FEEPAYINFO
create table OP_WMS_FEEPAYINFO (
[GID] [uniqueidentifier] NOT NULL,
[WMSID] [uniqueidentifier] NOT NULL,
[WMSBASEID] [uniqueidentifier] NOT NULL,
[FEESTARTDATE] datetime NOT NULL,
[FEEENDDATE] datetime NULL,
FEERATEWMSID uniqueidentifier null,
SOURCEDOID uniqueidentifier null,
[ARCLIENTWMSOUT] [varchar](50) NULL,
[APCLIENTWMSOUT] [varchar](50) NULL,
[ARCLIENTWMSIN] [varchar](50) NULL,
[APCLIENTWMSIN] [varchar](50) NULL,
[ARCLIENTWMS_OUTDO] [varchar](50) NULL,
[APCLIENTWMS_OUTDO] [varchar](50) NULL,
STORAGEUNITCOUNT numeric(22,6),
CONSTRAINT [PK_OP_WMS_FEEPAYINFO] PRIMARY KEY CLUSTERED
(
[GID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER VIEW [dbo].[Vw_Op_Wms_FeeBase] AS
select P.gid, w.[WMSID],[BSNO],[BILLTYPE],[REMARK],[CORPID],[CUSTOMERNAME],[MATERIALNO],[GOODSCODE],[GOODSNAME]
,[GOODSHSCODE],[MBLNO],[CNTRNO],[KGS],NETWEIGHT,[CBM],[PKGS],[KINDPKGS],[STORAGEUNIT]
,P.STORAGEUNITCOUNT
,P.FEERATEWMSID
,[ISCLEAR],[INDATE],WMSINDATE
,p.FEESTARTDATE
,(select FEERATESTARTDATE from op_wms where wmsid=p.FEERATEWMSID)FEERATESTARTDATE
,case when p.FEEENDDATE is null then (case when w.FEEENDDATE is null then '3000-12-12' else w.FEEENDDATE end)
else case when isnull(p.FEEENDDATE,'3000-12-12') > isnull(w.FEEENDDATE,'3000-12-12') then w.FEEENDDATE else isnull(p.FEEENDDATE,'3000-12-12') end
end [FEEENDDATE]
,[MBLNO]+[CNTRNO] MBLNOCNTRNO
,OP,CUSTOMNO,ACCBOOKNO,GOODSOWNER
,P.ARCLIENTWMSOUT
from OP_WMS_FEEPAYINFO p
left join OP_WMS w on p.WMSID=w.wmsid
where (case when p.FEEENDDATE is null then (case when w.FEEENDDATE is null then '3000-12-12' else w.FEEENDDATE end)
else case when p.FEEENDDATE > isnull(w.FEEENDDATE,'3000-12-12') then w.FEEENDDATE else p.FEEENDDATE end
end>=p.FEESTARTDATE )